w2form.set

Extends field object with obj.
set(field, obj)

Arguments

field string, name of the field
obj object, field object { name, type, required }
Returns boolean.

Description

This method will find and update the field object in the .fields array. If you change this array, you will need to call .refresh() method to update it on the screen. Note that this does not change the field value, it changes the field object, which contains description of the field. In order to change field value you need to update .records array and then call .refresh() method to update it on the screen.
If you have form defined in the following way: After the update the field_1 becomes an integer field. You could have looped through the .fields array of the form looking for the field and extending it to achieve same results.

If you need to update field value, for the form same as above you can do it in the following way:

User Comments

comments powered by Disqus