Forum Moderators: coopster

Message Too Old, No Replies

IE 6 Form Problem

         

ramoneguru

1:05 am on May 4, 2005 (gmt 0)

10+ Year Member



I have a simple form with a button that accepts something from an input box(its part of a table). Once submitted it should display a message saying their password has been recovered.

The problem I am having is once I hit the return key the form resets itself and clears my input. Is there anything I can do to correct this? Firefox seems to work fine when I input then hit the return key(while the cursor is in the textbox).

function getPwdRec()
{

print "<form action=\"pwdRec.php\" method=\"POST\" name=\"pwdRec\">\n";
print "<tr><td width=\"100\">&nbsp; </td>";
print "<td algin=\"center\" width=\"600\">Enter your email address: <input type=\"text\" name=\"email\" size=\"19\"> &nbsp;";

print "<input type=\"submit\" name=\"submit\" value=\"Submit\"> &nbsp;</td></tr></table> <br><br>";
print "</form>\n";

}//end getpwdRec

If the cursor is outside the textbox, then it will work fine and "submit" but if the cursor is inside, then it resets the form.....Any ideas?
--Nick

Stormfx

3:19 am on May 4, 2005 (gmt 0)

10+ Year Member



Did you paste that code? There's a typo that could cause it:

print "<td algin=\"center\" width=\"600\">Enter your email address:

ramoneguru

2:29 am on May 5, 2005 (gmt 0)

10+ Year Member



Spelling error, but still refreshes when you hit enter? Ideas?
--Nick

Stormfx

4:33 am on May 5, 2005 (gmt 0)

10+ Year Member



I'd have to see the rest of the code where the function is called. I don't see the problem being part of that code.

FalseDawn

5:10 am on May 5, 2005 (gmt 0)

10+ Year Member



This might help:
[ppeph.gla.ac.uk...]

Seems like you're experiencing a "feature" that stumped me for ages, too.

ramoneguru

8:04 pm on May 5, 2005 (gmt 0)

10+ Year Member



Ok, so from the above article I understood that if there were 2 submit buttons in the form, then once the user presses enter (even if the cursor is in the textbox) the form will be submitted using the first button. Is this correct? So here is the mod I made (just added another submit button)

function getPwdRec()
{
print "<table width=\"700\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
print "<form action=\"pwdRec.php\" method=\"POST\" name=\"pwdRec\">\n";
print "<tr><td width=\"100\">&nbsp; </td>";
print "<td align=\"center\" width=\"600\">Enter your email address: <input type=\"text\" name=\"email\" size=\"19\"> &nbsp;";

print "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
print "<input type=\"submit\" name=\"reset\" value=\"Reset\"></td></tr></table> <br><br>";

print "</form>\n";

print "<table width=\"700\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" >";
print "<tr><td> &nbsp; </td></tr>";
print "<tr><td align=\"center\"><hr width=\"60%\" size=\"1\" noshade></td></tr>";
print "<tr><td align=\"center\"><font size=\"-2\" face=\"arial\" color=\"#8d8d8d\"> ";

print "Copyright &copy; 2005 WaveForm. All rights reserved. </font></td></tr></table></center>";

}//end getpwdRec

getPwdRec();

ramoneguru

8:05 pm on May 5, 2005 (gmt 0)

10+ Year Member



However, it still doesn't work (sorry, I meant to add this in my previous post)
--Nick

FalseDawn

10:24 pm on May 5, 2005 (gmt 0)

10+ Year Member



As has been mentioned - really need to see the rest of the code (i.e. the form itself, and how you are processing the POSTs)
It sounds like the form is POSTing ok, but your code is not detecting this.

ramoneguru

2:26 am on May 6, 2005 (gmt 0)

10+ Year Member



if (isset ($_POST['submit'])) //process the form input
{
$tempEmail = $_POST['email'];
echo $tempEmail;
}
else
getpwdRec();

That's all there is, but even this still didn't work when the cursor is in the texbox. The submit button lights up when the cursor is in the text area, but once you hit the return key it resets....rather frustrating....
--Nick