views:

372

answers:

1

Howdy Folks,

iam using an dijit.form.NumberTextBox, if no value is inside it returns "NaN" , is there any way to set it to Zero ?

<dt><label for="xx"><?php echo $this->translate('xx');?></label></dt>
<dd><input type="text" name="xx" id="xx"
           dojoType="dijit.form.NumberTextBox"
           required="false"
           value="0"
           invalidMessage="xx" /></dd>
A: 

Depending on what you are doing, you could set required to true and then call isValid() before you get the value.

  var widget = dijit.byId('xx');
  if (widget.isValid()) {
     var num = widget.getValue();
  }

If you can't make it required, then I would say you would have to over-ride the getValue() in the widget

seth