Click to See Complete Forum and Search --> : forms and submit


David Harrison
01-05-2003, 11:39 AM
If you have some text bopxes that you put info into and then press submit it resets the entire for. How would I prevent it from doing this?

AdamBrill
01-05-2003, 12:50 PM
Well, it doesn't do that for me. Maybe you could try posting your code so I could look at it?

David Harrison
01-05-2003, 03:31 PM
here's an example:

<html>
<head>

<script language="javascript">

function Addup(){

a=addup.a.value;
b=addup.b.value;

Addup = window.open("","AddUp","height=300, width=400, scrollbars=yes, resizable=yes, status=yes");
Addup.document.writeln("<html><head><title>Add Up</title></head><body onload=\"create(this.form)\">");
Addup.document.writeln("<p align=\"center\"><font face=\"verdana\" size=\"4\"><b>Add Up</b></font></p>");

Addup.document.writeln((1*a)+(1*b))

Addup.document.writeln("<p align=\"center\"><font face=\"verdana\"><a href=\"javascript:window.close();\">Close</a></font></p></body></html>");}

</script>

</head>

<body>

<form name="addup">

<input type="text" name="a" size="20"> +

<input type="text" name="b" size="20"> = ???

<input type="submit" value="Add Up" onclick="Addup();">

</form>

</body></html>


You enter two values in the text boxes, press add-up and the values dis-appear.

AdamBrill
01-05-2003, 07:09 PM
On this line:

<input type="submit" value="Add Up" onclick="Addup();">

Change the type to button. That should fix it for you.

David Harrison
01-12-2003, 08:35 AM
Sorry I was wrong before, if i change submit to button it does leave the values in, however when I enter new values and click again it doesn't work.

khalidali63
01-12-2003, 08:55 AM
Seems like your error is in the same name for popup window and for the function that generates it.
change the popup window name to anything else and it should work for you.

ofcourse the type submit will be type button now

Khalid

David Harrison
01-17-2003, 02:38 PM
I thought they had to be the same name, just shows how muck I know