How can I find which button was clicked?
-
Hi experts. I just started programming in asp.net. Here is one task that I am having problems with. On a asp.net page there are 2 buttons(edit and save). I want to validate 2 fields only when the save button is clicked. If edit is clicked, then I don’t want to validate any fields. I thought that using javascript I can identify which button was clicked. Something like this: function Form1_onSubmit() { if(button clicked is btn save){ validate(); } else return true; } Thank you.
-
Hi experts. I just started programming in asp.net. Here is one task that I am having problems with. On a asp.net page there are 2 buttons(edit and save). I want to validate 2 fields only when the save button is clicked. If edit is clicked, then I don’t want to validate any fields. I thought that using javascript I can identify which button was clicked. Something like this: function Form1_onSubmit() { if(button clicked is btn save){ validate(); } else return true; } Thank you.
-
Hi experts. I just started programming in asp.net. Here is one task that I am having problems with. On a asp.net page there are 2 buttons(edit and save). I want to validate 2 fields only when the save button is clicked. If edit is clicked, then I don’t want to validate any fields. I thought that using javascript I can identify which button was clicked. Something like this: function Form1_onSubmit() { if(button clicked is btn save){ validate(); } else return true; } Thank you.
-
Hi experts. I just started programming in asp.net. Here is one task that I am having problems with. On a asp.net page there are 2 buttons(edit and save). I want to validate 2 fields only when the save button is clicked. If edit is clicked, then I don’t want to validate any fields. I thought that using javascript I can identify which button was clicked. Something like this: function Form1_onSubmit() { if(button clicked is btn save){ validate(); } else return true; } Thank you.
You can actually pass
this
. And within the function you can inspect the sender'sValue
attribute.Vasudevan Deepak Kumar Personal Homepage Tech Gossips
-
You can actually pass
this
. And within the function you can inspect the sender'sValue
attribute.Vasudevan Deepak Kumar Personal Homepage Tech Gossips