I want to run a simple JS function after my .NET validator controls run their javascript. My onsubmit value is javascript:return WebForm_OnSubmit();, which seems to be generated automatically and I can't change it.
Am I right in assuming I need to just add a function in this field to get it to work? Also, my form is validating after a field has been changed (not once the form has been submitted), which is great, but is there a setting soimewhere to turn that on/off?
Thanks!!
Althought it is a late answer I will post for future.
If your aspx page is a simple page (no ContentPage, so no MasterPage) you can add onsubmit function directly on the markup:
"WebForm_OnSubmit()"
will be executed first and then if validation is ok"myCustomValidation()"
will be executed.If your aspx page is a ContentPage (so it has a MasterPage) you don't have access to markup in order to do the same as before. You can set
"myCustomValidation()"
to be executed after"WebForm_OnSubmit()"
in code behind:The key is to set this code in
"PreRenderComplete"
event and not in"Load"
event, in order to execute"myCustomValidation()"
after"WebForm_OnSubmit()"
.