Opened 8 years ago
Closed 8 years ago
#17160 closed defect (worksforme)
NumberSpinner: associated input is not initialized with provided value
Reported by: | gillesl | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | undecided | Milestone: | 1.9.1 |
Component: | Dijit - Form | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description (last modified by )
While the NumberSpinner displays correctly, the input associated with it is initialized with an empty value when the page is loaded, instead of the value provided with the 'value' property. That input is initialized only once a key press down event is received. So if the form is submitted without interacting with the NumberSpinner, that input is submitted with an empty value. However, if the value is changed, either by clicking on the spinner arrows, or by typing the new value, then it works correctly.
Here is the code I use:
In the script tag in the header:
dojo.require("dijit.form.NumberSpinner");
In the body:
<div id="spinnerId"></div> <script type="text/javascript"> new dijit.form.NumberSpinner({ value: 9, constraints: {min:0, max:99, places:0}, id: "spinnerVal", name: "spinnerVal", style: "width:3em" }, "spinnerId" );
</script>
Debugging with firebug reveals a hidden input associated with the spinner:
<input type="hidden" name="spinnerVal">
At first, that input doesn't have any value, and if the form is submitted now, an empty value is submitted.
Interacting with the spinner modifies the input:
<input type="hidden" name="spinnerVal" value="8">
In that case, it works correctly.
This used to work in 1.8.3.
Thanks, Gilles
Change History (2)
comment:1 Changed 8 years ago by
Component: | Dijit → Dijit - Form |
---|---|
Description: | modified (diff) |
Milestone: | tbd → 1.9.1 |
Owner: | changed from bill to Douglas Hays |
Summary: | NumberSpinner associated input is not initialized with provided value → [regression] NumberSpinner: associated input is not initialized with provided value |
comment:2 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Summary: | [regression] NumberSpinner: associated input is not initialized with provided value → NumberSpinner: associated input is not initialized with provided value |
You forgot to call startup() after a programmatic instantiation.
It would be better if you could attach a full (but minimal) test case using the "attach file" button.