Forum Moderators: open

Message Too Old, No Replies

HTML Forms - Click the button works, press Enter doesn't

         

mike73

3:27 pm on Feb 20, 2006 (gmt 0)

10+ Year Member



I use forms all the time, all over the place, but for some reason, on one particular page, using IE, you have to click the submit button, if you press ENTER, it looks like the page refreshes, but nothing happens.

Anybody ever heard of this?

trillianjedi

3:43 pm on Feb 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[ppeph.gla.ac.uk...]

Not sure if you can use javascript to set the focus to the page somehow and call myform.submit() when enter is hit as a workaround?

From a usability point of view, I'm not sure whether this is a good idea though?

I hit enter by mistake all the time instead of tab.

TJ

mike73

3:54 pm on Feb 20, 2006 (gmt 0)

10+ Year Member



Thanks, I'll give it a try.

The strange thing is, Enter = Submit on all forms that only have one submit button; it's the default behavior. Why would it not work on theis form in particular?

trillianjedi

4:00 pm on Feb 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Has it got a "TEXTAREA" control in it?

According to that article I linked to above it seems that anything that has a "multi-line" control, i.e. may require the user to use ENTER as part of the submitted data, would disable the default behaviour.

Which makes sense really.

TJ

smagdy

10:21 pm on Mar 23, 2006 (gmt 0)

10+ Year Member



I have this exact problem now, but i have just 1 textbox that the user write in it his email to retrieve his password!

"I have to click the submit button, if i press enter, it looks like the page refreshes, and nothing happens!"

How did you solve it?

Thanks in advance

mike73

8:51 am on Mar 26, 2006 (gmt 0)

10+ Year Member



I never found a solution. I still have the same problem.

smagdy

9:20 am on Mar 26, 2006 (gmt 0)

10+ Year Member



I found the PERFECT solution and i am sure you will thank me now :)

But this is if u like me have just one single <input> in that page...

So the solution is to add another one and use css to hide it.

<input name="" type="t" value="" style="display:none">

This worked perfect with me on IE6

Good luck

mike73

5:15 pm on Mar 26, 2006 (gmt 0)

10+ Year Member



OMFG it worked!

Thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you thank you!

Where the heck did you find that trick?

smagdy

5:26 pm on Mar 26, 2006 (gmt 0)

10+ Year Member



Ha ha ha I expected ONE THANK YOU :)

Hmm just in a site, i dont remember where is it, but the one was writing this was very confident ha ha!

I was very happy too but now am hitting my head in the wall... i dono whats wrong with this thing am doing now.

IE and Opera suddenly cant feel any sessions and suddenly it sees them and work ... and all i do is refreshing the page and all that happend suddenly without changing anything!

I cant even post here to ask whats wrong cuz its very crazyyyy!

smagdy

5:26 pm on Mar 26, 2006 (gmt 0)

10+ Year Member



Btw i am happy that i helped someone here.. i mean i always ask so that was first time to help!

jt007superman

4:13 am on Mar 27, 2006 (gmt 0)

10+ Year Member



I've tried everything to recreate this problem, and I just can't. I have IE6, Mozilla FF, and NS running on my machine and couldn't cause the problem your talking about.

I'd like to look further into the cause of the problem so I can post the specific cause and best solution. I do know two of the problems. One is from your form not having focus, which leaves your address bar, in which case the page would refresh only. Secondly the form might not have a "Successful control" specified by the HTML4.1 spec, but I want to know more.

[edited by: tedster at 4:35 am (utc) on Mar. 27, 2006]

mike73

5:50 pm on Mar 27, 2006 (gmt 0)

10+ Year Member



Superman, here's the non-working code from my page:


<html>
<head>
<title>Diary Lock</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel='stylesheet' href='http://www.example.net/path/file.css'></head>
<body bgcolor="#ffffff">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center">
<table border="0" bordercolor="#b0424f" id="loginT" align="center" cellpadding="3" cellspacing="0">
<tr bgcolor="#b0424f">
<th style="border:0px">Sidan Skyddad</th>
</tr>
<tr>
<td align="left" valign="top" style="border:0px">
<p>Du behöver ett lösenord för att<br>kunna titta på denna sidan.</p>
<p>
&nbsp;</p>
<strong>Lösenord</strong>:<br>
<form method="post" action="lock.php?id=mitha&from=%2Fdiary.php%3Fid%3Dmitha">
<input type="password" name="txtPass" id="txtPass" style="width:100%">
<input name="chkRM" type="checkbox" style="border:0px; height:11px; width:11px" id="chkRM" value="1">
Kom ihåg mig<p>&nbsp;</p>
<input name="Unlock" id="Unlock" type="submit" style="width:100%" value="Låsa Upp">
</form>
</td>
</tr>
</table>
<p align="center">[<a href="http://www.example.se" target="_blank">Powered
by Company</a>]</p></td>
</tr>
</table>
</body>
</html>

[edited by: tedster at 5:56 pm (utc) on Mar. 27, 2006]
[edit reason] use example.com in code [/edit]