v17.2 but I tried it on the latest and I get the same issue.
I set the value of a text input via jQuery. Then I declare the input as an igNumericEditor. The value set doesn't carry over so when my form is posted it doesn't contain the value. It comes over as blank.
<input type="text" id="field" name="field" /> <button onclick="javascript:showValue();">Show Value</button>
<script type="text/javascript"> $(function () { $("#field").val(10); //$("#field").igNumericEditor(); }); function showValue() { alert($("#field").val()); } </script>
The value should be carried over when initializing a control but it does not.
Hi,
Thank you for contacting us!
In the attached file there is a sample code with version 17.2 of Ignite UI for JavaScript that initializes the value of the igNumericEditor with the value of the predefined input.I used the rendering event to accomplish this.
Please, take a look at it and let me know if you have any further questions.
igNumericEditorSample.zip
Yes that works but that doesn't explain the behavior of why the control doesn't do this during initialization.
The igNumericEditor reads the attribute value, which is very convenient if you use server side rendering.
On the client side you can use the value method.In your scenario you can use this approach:
<body> <input type="text" id="field" name="field" /> <button onclick="javascript:showValue();">Show Value</button> <script type="text/javascript"> $(function() { $("#field").attr("value", "10"); $("#field").igNumericEditor(); }); function showValue() { alert($("#field").igNumericEditor("option", "value")); } </script> </script> </body>
Please, let me know if you have any further questions.