PDA

View Full Version : Forms



robert.cfi
08-12-2009, 04:50 PM
Hi, I hope I am not posting in the wrong place.

I have a form that i would like for when you pull up the page that the cursor is already in the first block or "field" how do I get that to work?

I have looked all over in JS and looked through form tutorials, even crawled googles source because google is good example of what I want it to do. Just could not figure out what it was that was making it do that.

Thanks for the help guys!

wige
08-12-2009, 04:59 PM
The following JS should do it. Simply change "elementid" to the id of the field you want to receive focus.


<script type="text/javascript">
<!--
if (document.getElementById) {
document.getElementById("elementid").focus();
}
// -->
</script>

Uncle Dog
08-12-2009, 05:00 PM
Use javascript focus() called by the body onLoad() function. Need more?

robert.cfi
08-12-2009, 05:03 PM
thanks guys! i knew it was JS.

robert.cfi
08-12-2009, 05:12 PM
I cant get it to work

here is the code

<td><font color="#003082" face="Franklin Gothic Book"><b><font color="#003082">Order
Number</font></b></Font></td>
<td><input type="text" Name="Order_Number" size=06 maxlength=06></td>

does it have to do with it being "Name" instead of "Id"? I switch and tried both Id and Name.

robert.cfi
08-12-2009, 05:46 PM
I got it to work.

Had to add a name to the whole form not just the field.
Also had to have the JS after the form.

thanks for the help guys