View Full Version : Resolved Form issue - cursor always on first input

06-26-2010, 11:47 PM
I have a multipart form and while everything seems fine in IE (which I actually don't use except to check for cross browser compatibility) but there is an issue in FF and Chrome.

In those two browsers, when clicking on one of the form inputs it always puts the cursor back at the first form input.

<div class= "formbox">
<hr />
<form action="editprofile.php" enctype="multipart/form-data" method="post" name="nameform" id="nameform" class= "formsection">
<span>First Name</span>
<input name="firstname" type="text" class="formFields" id="firstname" value="<?php $firstname= stripslashes($firstname); $firstname= stripslashes($firstname); print "$firstname"; ?>" />
<span>Middle Name</span>
<input name="middlename" type="text" class="formFields" id="middlename" value="<?php $middlename= stripslashes($middlename); print "$middlename"; ?>" />
<span>Last Name</span>
<input name="lastname" type="text" class="formFields" id="lastname" value="<?php $lastname= stripslashes($lastname); print "$lastname"; ?>" />
<span>Nick Name</span>
<input name="nickname" type="text" class="formFields" id="nickname" value="<?php $nickname= stripslashes($nickname); print "$nickname"; ?>" />
<input name="parse_var" type="hidden" value="name" />
<div class= "editsubmitbutton" id= "namesubmit">
<input type="submit" name="button" class= "editsubmitbuttonlook" id="namebutton" value="Update Your Name" />

So in this example, if you click on, say, lastname, the cursor immediately goes back to firstname. It works in IE though. And for dropdown menus (like birthday), which work in IE, it "clicks off" and doesnt keep the selection window open when you click to go through the menu like a typcal user would, making it impossible for any typical user to fill it out and extremely annoying for anyone else.

Anyone know why I have this problem and what I could do to fix it? Thanks.

06-27-2010, 12:05 AM
Link or no dice.

06-27-2010, 12:14 AM
I'm surprised IE doesn't do this either. Its the label. The label is meant to be linked to only one form input, not all of them like you did. Because you put the inputs in the label then clicking anywhere in the label will set focus to the first input. If you don't want this happening then put only one input per label. Here is how to use them properly.


06-27-2010, 12:25 AM
That makes too much sense! Can't believe I didn't think about it. I knew I was being naughty with the label anyway. Should have known it would coe back to haunt me. Will fix this and verify. Thanks.

-edit- Resolved!