NaN -> 0 for number fields

This commit is contained in:
Vincent Fiduccia 2015-02-03 17:41:27 -07:00
parent 81d7e296ca
commit df62d4315f
2 changed files with 3 additions and 2 deletions

View File

@ -88,6 +88,7 @@
<select name="{{formFieldName}}" class="form-control" onchange="htmlapi.createTypeChanged($(this).val());"> <select name="{{formFieldName}}" class="form-control" onchange="htmlapi.createTypeChanged($(this).val());">
{{#each field.options}} {{#each field.options}}
<option value="{{this}}" {{#ifEqual this ../value}} SELECTED{{/ifEqual}}>{{this}}</option> <option value="{{this}}" {{#ifEqual this ../value}} SELECTED{{/ifEqual}}>{{this}}</option>
<!-- {{this}} , {{../value}} -->
{{/each}} {{/each}}
</select> </select>
{{/ifEqual}} {{/ifEqual}}

View File

@ -1726,11 +1726,11 @@ HTMLApi.prototype.getFormValues = function(mode, method, schema)
} }
else if ( field.type == 'int' && v !== null) else if ( field.type == 'int' && v !== null)
{ {
body[k] = parseInt(v,10); body[k] = parseInt(v,10)||0;
} }
else if ( field.type == 'float' && v !== null) else if ( field.type == 'float' && v !== null)
{ {
body[k] = parseFloat(v); body[k] = parseFloat(v)||0;
} }
else if ( typeof v != 'undefined' ) else if ( typeof v != 'undefined' )
{ {