Object of event handlers for form actions.
Object, default = {}
When you define HTML template for the form, you can add buttons. If you add name attribute to the button it will be associated with the same action in the form. The HTML code below shows how to define buttons properly: <div class="w2ui-page page-0"> ...form fields ... </div> <div class="w2ui-buttons"> <input type="button" value="Reset" name="reset"/> <input type="button" value="Save" name="save"/> </div> Now for each button you can define an action in the form $('#form').w2form({ name : 'form', url : 'server/post', record: { field_1 : 1, field_2 : 2 }, fields: [ { name: 'field_1', type: 'text', required: true }, { name: 'field_2', type: 'alphanumeric', required: true } ], actions: { "reset": function () { this.clear(); }, "save": function () { this.save(); } } }); Please note that the name of the action must match the name of the button (case-sensitive).
If you want to execute an action, you can call .action() method. There is also .onAction event that gets triggered each time action is executed.