Reply to Re: month and day of month edit fields

Your name:

Reply:


Posted by Toby A Inkster on 02/20/07 14:15

Captain Paralytic wrote:

> 1) Use pure local javascript to populate the day select based on the
> selected month. No submit required at all.

Better still, initially provide a day select with 31 days, and then
*depopulate* it based on the selected month. That way:

- it's still very usable for non-JS users;
- people can select the day first, then the month, if they wish.

> 2) Use an AJAX type call to let php/javascript populate the day
> select.

As Kimmo said, AJAX is overkill here. Using AJAX, you add an extra
round-trip to the server, break your form in non-AJAX-capable browsers,
all for no real benefit. It's trivially easy to calculate the number of
days in any given month using client-side Javascript. No advantage
whatsoever in having the server do it for you.

(Of course, you will still need to do sanity checks on the server! One
must always do so!)

An alternative would be something like:

<select>
<option>01 Jan
<option>02 Jan
<option>03 Jan
...
<option>30 Dec
<option>31 Dec
</select>

though that adds about 5 kB of data to the page.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация