dojo form submit on change of value

460 views Asked by At

I have a dojo table container embedded within dojo form. I'm able to validate all dijits like textbox, combobox etc and submit the form. But what I need is, submit the form only when a value is changed i.e. if a textbox value is changed, submit the form else don't.

2

There are 2 answers

0
vijay On

Add a hidden text input field which is empty while loading page. Then After you make a change in your text field check the content in the hidden text field and your respective text field if they are same then don't submit the form.

0
srivelayutha raja On

Dojo input fields maintain the original value in the private attribute of '_resetValue'. Before submitting the form, you can check whether _resetValue is different from .get('value') and submit the data..

If all the attributes are under the Table container, you can fetch the children of the table containers and verify using array.every() function..

var unmodified = array.every(container.getChildren(), function(widget){
   return widget._resetValue == widget.get('value');
});