1
I need to validate some field, forcing the user to provide the data before saving in database, if it does not provide the data, the edge of the control turns red stating that there is something wrong with the field.
I have already been able to validate by javascript in the onBlur event for the field to turn red, more when I save the save button of a post on the page and the fields that were with the red border loses the color.
You can call javascript for each page post, to validate the fields?
the javascript code
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>
You have tried http://jqueryvalidation.org/ Jquery Validation?
– FernandoLopes