[thelist] PHP/html form queston: a better way to do this form and submission?

ben morrison morrison.ben at gmail.com
Thu Aug 11 11:08:30 CDT 2005


> <td colspan="2"><label for="home_phone_number">Home Phone
> Number:</label><br> <input
>                         class="textbox" maxlength="6" size="6"
> name="area_code" id="area_code" value="{$_POST['area_code']}"> &nbsp;
>                     <input
>                         class="textbox" maxlength="6" size="6"
> name="3_digit_exchange" id="3_digit_exchange"
> value="{$_POST[3_digit_exchange]}" > &nbsp;
>                     <input
>                         class="textbox" maxlength="10" size="10"
> name="last_four_digits" id="last_four_digits"
> value="{$_POST['last_4_digits']}"> &nbsp;
>                   </td>
> 
> with different input values for the area code, 3 digit exchange and
> last 4 digits. and then you check the values of each and post either
> the results or an error.
> 
> Posting 'You didn't enter your " .$fieldname " might be confusing if
> the fieldname is "last_four_digits" so, I was hoping of a more
> simplified way to do this type of information in my form.
> 
> Also is there a way for the form to automatically go to the next field
> once a certain amount of info. has been entered? eg: after putting in
> 3 digits for the area code, the cursor will automatically jump to the
> next field?

Bruce,

My first thoughts are that you are over complicating the matter and
therefore are trying to fix something that should be as easy as please
enter your phone number (including area code).

Your label is not associated with any of the input fields, for
accessibility you should also have a label for each part of the phone
number - these could be hidden offscreen using CSS.

Using javascript to jump to the next field is also a usability problem
- its a nice idea but most users are used to using tab to jump to the
next field so they would type their digits, the focus would jump to
the next input, then they would press tab to the next input and start
typing so it would/could be quite annoying.

Personally I would use one input box.

Ben


More information about the thelist mailing list