Trying to integrate some extra javascript into an outdated ASP.net form for validation purposes. The form currently utilizes ASP.net validators such as asp:RangeValidator
and asp:RequiredFieldValidator
.
The following is the javascript code generated for the 'Save' button.
<input type="submit" name="ctl00$cphContent$btnSave" value="Save"
onclick="javascript:if(!validateFirstDate('ctl00_cphContent_txtDate',
'ctl00_cphContent_txtDateRepayment', 'ctl00_cphContent_lblRepaymentMode'))
return false;
WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("ctl00$cphContent$btnSave", "",
true, "", "", false, false))" id="ctl00_cphContent_btnSave" class="ButtonStyle">
My new function 'validateFirstDate'
has been added using
btnSave.Attributes.Add("onclick", "javascript:if(!validateFirstRepaymentDate...
while WebForm_PostBackOptions...
is automatically generated by ASP.net for validations.
Issue at hand: Looking to execute my additional script after the ASP.net script only if the default validations fail (current setup executes the first function regardless). Struggling to find a solution.
Any assistance would be greatly appreciated.
(Primarily experienced in Java, but tasked with fixing this older project in ASP.net)