Jump to content

Whats my alternative to using a dropdown menu...


batstanggt

Recommended Posts

Text boxes are probably the easiest way to do it.

<html>

<form action='post.php' method='post'>

Birth Date: <input type='text' name='day' maxlength='2' style='width: 25px;'/>-<input type='text' name='month' maxlength='2' style='width: 25px;'/>
-<input type='text' name='year' maxlength='4' size='1'/>
</form>

</html>

Link to comment
Share on other sites

Text boxes are probably the easiest way to do it.

<html>

<form action='post.php' method='post'>

Birth Date: <input type='text' name='day' maxlength='2' style='width: 25px;'/>-<input type='text' name='month' maxlength='2' style='width: 25px;'/>
-<input type='text' name='year' maxlength='4' size='1'/>
</form>

</html>

 

 

Of course you'll want to add some kind of label to indicate where to enter the day/month/year. Some format their dates as DD-MM-YYYY, while others may use MM-DD-YYYY.

Link to comment
Share on other sites

Why do you not want to use a dropdown? I prefer dropdowns, it's easy to generate an array of days, months and years with PHP and loop over them to create the dropdowns. You can even add in some JavaScript to alter the number of days on specific months if you want to get technical, otherwise do the validation server side when they submit.

 

The easiest way for the coder though would be input boxes, although validation will still be required.

Link to comment
Share on other sites

The most simplistic from my perspective is something that is the most simplistic for the end user. jquery ui offers a date picker that is just that.

 

Agreed. HOWEVER, this would not be so "simple" to implement and would require additional validation since javascript might be disabled.

Link to comment
Share on other sites

The most simplistic from my perspective is something that is the most simplistic for the end user. jquery ui offers a date picker that is just that.

 

Agreed. HOWEVER, this would not be so "simple" to implement and would require additional validation since javascript might be disabled.

that is indeed the perspective from the coder, not the end user. implementing the jquery ui is probably easier to implement than baking a good cake.

besides that <noscript> is exactly for the 0.5 % of the people that have it disabled. anyway i think the Topic starter ran away :P

Link to comment
Share on other sites

anyway i think the Topic starter ran away :P

 

 

All the more reason for the rest of us to argue the nitty-gritty details. :P

 

@TheFilmGod - no matter which option is chosen, it's still a good idea to validate the input...even with drop downs. Someone could bypass the drop-downs, turn off JavaScript, etc. in an attempt to inject bad stuff.

Link to comment
Share on other sites

Cyberrobot - YES, server side validation is a must! Even the actual values in the dropdowns can be spoofed/edited therefore do not ever trust the values specfically provided. Who would have thought that?

 

 

The comment was based on the following:

 

...would require additional validation...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.