I need to validate some field, forcing the user to provide the data before saving to a bank, if it does not provide the data, the border of the control goes red stating that there is something wrong with the field.
I've already been able to validate by javascript in the onBlur event for the field to become red, but when I save the save button from a post on the page and the fields that were with the red border lose color.
How can every page post call the javascript, to validate the fields?
the code in javascript
function ValidatxtECFNrSerie(controle) {
if (controle == '') {
$('#' + '<%= txtECFNrSerie.ClientID %>').addClass('validationError');
}
else {
$('#' + '<%= txtECFNrSerie.ClientID %>').removeClass('validationError');
}
}'
<asp:Label ID="lblNrSerieECF" Text="Nr. Série ECF/SAT:" runat="server" />
</div>
<div class="dataForm">
<asp:TextBox ID="txtECFNrSerie" runat="server" MaxLength="15" Width="150px" onBlur="javascript:ValidatxtECFNrSerie(this.value)"></asp:TextBox>
</div>