Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#11914 closed defect (invalid)

DateTextBox bug

Reported by: rbrown Owned by:
Priority: high Milestone: tbd
Component: Dijit - Form Version: 1.5
Keywords: Cc:
Blocked By: Blocking:


There seems to be a bug in DateTextBox? which prevents it from displaying a "required field" error state after loading a document. If the DateTextBox? is required and given an empty value at load-time it will display as valid until the user clicks on it.

This is big problem for my page which disables the save button until all controls are valid. I can detect the error state using the "aria-invalid" attribute generated by dojo and correctly disable the save button. However if the user only fills in controls displaying as required (with yellow background) the save button remains disabled and they have no clue why.

I have tried several workarounds with no luck. In the code fragment below I call the DateTextBox?.validate() function after loading but it does nothing. I tried injecting the value "required" which is not a date, but the DateTextBox? nicely clears that value and remains in a confused state (error inside, valid looking outside). I have tried calling the onBlur() function and triggering various events but had no luck there either. I was able to change the css classes of the widget after loading, but that does not get cleaned up after the user inputs a valid date.

Is there something else I should be trying?


<!DOCTYPE HTML PUBLIC "-W3CDTD HTML 4.01EN" ""> <html dir="ltr" xmlns="">


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Date Picker Bug Demo</title>

<link rel="stylesheet" type="text/css" href=""/> <style type="text/css">

body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }


<script type="text/javascript" src="" djConfig="parseOnLoad: true"> </script> <script type="text/javascript">




dijit.byId("date1").validate(false); });

</script> </head> <body class=" tundra ">

<input type="text" name="date1" id="date1" value="" dojoType="dijit.form.DateTextBox?" required="true" /> this is text following the date picker <button>button used for focus testing</button>



Change History (2)

comment:1 Changed 11 years ago by bill

Resolution: invalid
Status: newclosed

This is intended behavior and is also the way that most websites (with forms) work.

If you want all fields to be initially marked invalid you could do a number of things, like wrapping everything in a dijit.form.Form and calling form.validate().

comment:2 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.