Forum Moderators: coopster

Message Too Old, No Replies

Form input help

         

smartcard

10:41 pm on Oct 16, 2005 (gmt 0)

10+ Year Member



I have a PHP form where the user is given a text box to type a number. When I execute this script the page is appearing correctly with the text box for the user to input the data, but the mouse pointer is not by default pointing at the box, so the user is required to click at the box first before typing any input in the text box.

How can I set the code to take the mouse point to the input box by default?

following is the code:


<form method="POST" action="process.php" enctype="multipart/form-data">
<table cellpadding="3" cellspacing="1" width="476" >
<TR><TD width="312">&nbsp;</TD><TD width="149"><img src="image.php"></TD></TR>
<TR><TD width="312">&nbsp;</TD><TD width="149">
<input type="text" name="code" size="11" ></TD></TR>
<TR><TD width="312">&nbsp;</TD><TD width="149">
<input type="submit" value="Proceed" ></TD></TR>
</table></form>

steerpike

2:26 am on Oct 17, 2005 (gmt 0)

10+ Year Member




try this:

<body onLoad="document.form1.code.focus();">

<form name="form1" method="POST" action="process.php" enctype="multipart/form-data">
<table cellpadding="3" cellspacing="1" width="476" >
<TR><TD width="312">&nbsp;</TD><TD width="149"><img src="image.php"></TD></TR>
<TR><TD width="312">&nbsp;</TD><TD width="149">
<input type="text" name="code" size="11" ></TD></TR>
<TR><TD width="312">&nbsp;</TD><TD width="149">
<input type="submit" value="Proceed" ></TD></TR>
</table></form>