ASP.Net MVC + Live validation - how come the flagged text are all over the place?
- by melaos
hi guys,
this is an asp.net mvc project and
<% using (Html.BeginForm("ProductAdded", "Home")) { %
Register Your Product
<%= ViewData["MainHeader"]%
<p><%=ViewData["IntroText"]%></p>
<div style="display: none;">
<div id="regionThreePane">
<table border="0" cellpadding="0" cellspacing="0" frame="void" style="width: 100%">
<tr>
<td width='250px'><select name="ProdLBox1" id="ProdLBox1" class="ProdLBox1" size="8"></select></td>
<td width='250px'><select name="ProdLBox2" id="ProdLBox2" class="ProdLBox2" size="8"></select></td>
<td width='250px'><select name="ProdLBox3" id="ProdLBox3" class="ProdLBox3" size="8"></select></td>
</tr>
</table>
</div>
i'm using live validation for my client side validation.
var v_fname = new LiveValidation('Customer_FirstName', { validMessage: " " }, { onlyOnSubmit: true });
v_fname.add(Validate.Presence, { failureMessage: enterfirstname});
var v_lname = new LiveValidation('Customer_LastName', { validMessage: " " });
v_lname.add(Validate.Presence, { failureMessage: enterlastname });
var v_email = new LiveValidation('Customer_Email', { validMessage: " " });
v_email.add(Validate.Presence, { failureMessage: enteremail, validMessage: " " });
v_email.add(Validate.Email, { failureMessage: entervalidemail});
and what i notice is that after doing some button call:
$(".btnAddProduct").click(function() {
//Check first to see if there's anything to be added
if (parseFloat($(".tboAddProduct").val()) < 1) {
//TO DO: to replace with localized text
var selectProductError = "Please select a product first";
$("#validationSummary").text(selectProductError);
//alert("Please select a product first");
return false;
}
$(".PanelProductReg").show();
addProductRow($(".tboAddProductId").val(), $("#tboAddProduct").val());
});
what will happen is that the validation tags will start to appear for the whole page for all the input which are tag for the live validation.
instead of just appearing when the controls are being higlighted and onblur.
i'm using some ajax calls to get data and a lot of jquery to dynamically do the gui stuff.
could any of this be causing some sort of an internal conflict?
thanks