Opened 12 years ago

Closed 12 years ago

Last modified 8 years ago

#6267 closed defect (invalid)

ValidationTextBox and TextBox do not set default value from input attribute "value"

Reported by: guest Owned by:
Priority: high Milestone:
Component: Dijit - Form Version: 1.1b1
Keywords: Cc: navin@…
Blocked By: Blocking:

Description

In latest SVN codebase (also in 1.0 as well), there is a bug in that you cannot set the value attribute in layout, and get a default value to show up in the form, and populate on form reset. I have modified the templates slightly on both, and it seems to have fixed the problem.

output of svn diff:

Index: dijit/form/templates/TextBox.html =================================================================== --- dijit/form/templates/TextBox.html (revision 13154) +++ dijit/form/templates/TextBox.html (working copy) @@ -1,4 +1,4 @@

<input class="dijit dijitReset dijitLeft" dojoAttachPoint='textbox,focusNode' name="${name}"

dojoAttachEvent='onmouseenter:_onMouse,onmouseleave:_onMouse,onfocus:_onMouse,onblur:_onMouse,onkeypress:_onKeyPress'

  • autocomplete="off" type="${type}"
  • /> No newline at end of file

+ autocomplete="off" type="${type}" value="${value}' + /> Index: dijit/form/templates/ValidationTextBox.html =================================================================== --- dijit/form/templates/ValidationTextBox.html (revision 13154) +++ dijit/form/templates/ValidationTextBox.html (working copy) @@ -6,7 +6,7 @@

<div class="dijitReset dijitValidationIconText">&Chi;</div <div class="dijitReset dijitInputField" <input class="dijitReset" dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus:_update,onkeyup:_update,onblur:_onMouse,onkeypress:_onKeyPress' autocomplete="off"

  • type='${type}' name='${name}'

+ type='${type}' name='${name}' value='${value}'

/></div

</div </div>

Attachments (1)

textbox.diff (1.2 KB) - added by guest 12 years ago.
Output of svn diff (screwed up in ticket)

Download all attachments as: .zip

Change History (3)

Changed 12 years ago by guest

Attachment: textbox.diff added

Output of svn diff (screwed up in ticket)

comment:1 Changed 12 years ago by Douglas Hays

Resolution: invalid
Status: newclosed

This is by-design. The form widgets are not just wrappers to native elements. The value attribute is special. So for DateTextBox? widgets, the value is something like 2008-12-31 but the value in the textbox is localized and internationalized. Users should call getValue() to get the true value, and setVaue to set it programmatically. Each TextBox? subclass supports the reset() method. Please refer to dijit.tests/form/test_validate.html for an example. The Form widget also has a reset() method that is called on the reset event (please see dijit/tests/form/Form.html for an example).

comment:2 Changed 8 years ago by bill

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