locked
OnChange event triggering twice RRS feed

  • Question

  • Hi,

    I have a text field, I am calling a method on "OnChange" event to validate the text. I am calling the same method on "OnSave" event as well. 

    Problem is when I enter text in the field and then click on the save button without losing focus from the field i.e. without tab from the field, validation method is getting called twice. It first triggers the onchange event and then onsave.

    Is there any way to call this method once?

    Thanks,

    Rohit

    Tuesday, April 1, 2014 6:12 AM

All replies

  • Hi,

    I have a doubt that you want to perform that operation on both onsave and onchange of the event?

    If you want to fire javascript only onchange of the particular field use only Onchange no need of doing it on onsave event.


    Divija Vemulapalli



    • Edited by Divija Tuesday, April 1, 2014 7:18 AM
    Tuesday, April 1, 2014 7:09 AM
  • I am not clearing the value after validation, user can click the save button.

    Thanks,

    Rohit

    Tuesday, April 1, 2014 8:46 AM
  • I do believe that no need of writing java-script on onsave event. Onchange event is enough. Even though user clicks save button the value will get saved without performing onsave.


    Divija Vemulapalli


    • Edited by Divija Tuesday, April 1, 2014 9:42 AM
    • Proposed as answer by Divija Tuesday, April 1, 2014 9:43 AM
    • Unproposed as answer by Divija Tuesday, April 1, 2014 9:43 AM
    • Proposed as answer by Divija Wednesday, April 2, 2014 4:40 AM
    Tuesday, April 1, 2014 9:39 AM
  • No need to call method on "onSave" event.
    Tuesday, April 1, 2014 11:58 AM