PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #5701

Day of Month should be Text field

Details

Submitted2005-10-16 15:00 UTC
Fromaskwersky at comcast dot net
StatusWont fix
PackageHTML_QuickForm
PHP Version5.0.0
OSMac OS X/Any
Roadmaps(Not assigned)

Comments

[2005-10-16 15:00 UTC] askwersky at comcast dot net

Description:
------------
The day of the month is always 1-31 in the select menu. This allows incorrect dates to be entered (i.e. September 31).

To correct this, the day of month should probably be a small text entry field with JavaScript or Server side validation of the day. Using a select menu obviously makes it difficult to make this field 'validate-able'

I am aware of "request #2225" and I think the solution provided is inadequate.

[2005-10-16 17:56 UTC] mansion at php dot net

Using a text input allows for even more errors.
Simply use a validation rule that would call the checkdate() php function:

function checkdate($value)
{
if (checkdate($value['M'], $value['d'], $value['Y'])) {
return true;
}
return false;
}

$form->registerRule('checkdate', 'callback', 'checkdate');
$form->addRule('mydate', 'Incorrect date', 'checkdate');

[2005-10-17 03:12 UTC] askwersky at comcast dot net

How does it add more errors to change the select into a
text field? You mean the user could type in something
non-numeric? I think it is worth that risk. Its
confusing to have something be on a menu but then not
let the user select it. Putting a value on a select
implicitly says to the user "this value is OK".