The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> get data from html form and write into a file, javascript, get data from html form and write into a file, javascript
Daralis
post Apr 25 2012, 05:47 PM
Post #1





Group: Members
Posts: 5
Joined: 25-April 12
Member No.: 16,984



Im trying to write data retrieved from html form, but can't make it work. Please help me. Iam a newbies to this.

Thanks so so much.


<script LANGUAGE="JavaScript">
function Write(input0, input1, input2)
{
var Scr = new ActiveXObject("Scripting.FileSystemObject");
var CTF = Scr.CreateTextFile("employeefile.txt", 1, true);
CTF.WriteLine(input0 + ","+ input1 + ","+ input2);
CTF.Close();
}
function validateForm()
{
var x1=document.userform.pwd.value;
var x2=document.userform.re_pwd.value;
if (x2 == x1)
{
document.write(document.userform.empname.value)
Write(document.userform.empname.value, document.userform.user.value, document.userform.pwd.value);

}
else
{
alert("Passwords are not the same, Re-enter password");

}
}
</SCRIPT>

</head>

<body>

<table width=100% border="0">
<tr>
<td style="background-image:url(http://farm8.staticflickr.com/7092/7114162767_1c07772c85.jpg); background-size:cover;">
<p style="font-family:Britannic Bold;font-size:180%;color:#3300FF;text-align:center;"> <br /><br /> REGISTER </p><br />
</td>

</tr>

<tr>
<td style="background-color:#EEEEEE;height:700px;background-size:cover;text-align:center;">

<form ACTION="" NAME="userform" METHOD="GET" ONSUBMIT="return validateForm()">Create employee profile: <BR><br /><br />
Employee Name: &nbsp; &nbsp; <input type="name" name="empname" size="35"/><br /><br />
Username: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="logintext" name="user" size="35"/><br /><br />
Password: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <input type="password" name="pwd" size="35"/><br /><br />
Re-enter Password: <input type="re_password" name="re_pwd" size="35"/><br /><br />

<input type="submit" value="Submit" size="35"/>
</form>
</td>
</tr>

<footer>

<tr>
<td colspan="2" style="background-color:#FFA500; width:100%; height=50px; text-align:center;">
Copyright © 2012 QGS Inc.
</td>
</tr>
</table>
</footer>

</body>
</html>

This post has been edited by Daralis: Apr 25 2012, 06:27 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
Brian Chandler
post Apr 26 2012, 04:33 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Are you really trying to write this to a file on the visitor's computer?

(As I understand it, normally javascript has no access to the local file system, for obvious reasons. Perhaps this "activeX" stuff is part of the MS virus dissemination kit, but if so it won't work in many cases.)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
Daralis   get data from html form and write into a file, javascript   Apr 25 2012, 05:47 PM
Brian Chandler   Are you really trying to write this to a file on t...   Apr 26 2012, 04:33 AM
Daralis   Are you really trying to write this to a file on ...   Apr 26 2012, 10:54 AM
Brian Chandler   Are you really trying to write this to a file on...   Apr 26 2012, 11:50 PM
pandy   A couple of things. I can't get this to work w...   Apr 27 2012, 02:07 AM
Christian J   What does the second parameter (1) in the CreateT...   Apr 27 2012, 07:39 AM
pandy   Could it be because document.write(documen...   Apr 27 2012, 07:47 AM
Christian J   IE seems to require double slashes in the path (c...   Apr 27 2012, 10:13 AM
pandy   Yes, from the page I linked to.   Apr 27 2012, 10:17 AM
Christian J   A more traditional approach might be to write the ...   Apr 26 2012, 07:12 AM
Daralis   A more traditional approach might be to write the...   Apr 26 2012, 10:56 AM
Christian J   See for example http://www.quirksmode.org/js/cooki...   Apr 26 2012, 11:54 AM
Christian J   For example, if the first character in the filen...   Apr 27 2012, 10:20 AM
pandy   Nope. I named my test files 1.txt, 2.txt and so on...   Apr 27 2012, 11:20 AM
Christian J   BTW, how much do you have to lower MSIE's secu...   Apr 27 2012, 12:03 PM
pandy   I didn't lower anything, just has to OK the ac...   Apr 27 2012, 12:41 PM
Christian J   I didn't lower anything, just has to OK the a...   Apr 27 2012, 02:43 PM
pandy   Of course it's local and didn't make any r...   Apr 27 2012, 03:59 PM
Christian J   Of course it's local and didn't make any ...   Apr 28 2012, 07:52 AM
pandy   You said above that registry changes were needed, ...   Apr 28 2012, 08:38 AM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 18th April 2024 - 05:40 AM