Hi, amircx...
I think what you're missing is the last part of the code below:
$("#Result").empty().append(data);
I believe the purpose of that line is to remove the previous error message
before a new one is displayed.
Here's how it fits into my entire "CalculateMortgage" function that precedes
the code I sent yesterday...
See if this info help you...
Rick
submitHandler: function(){
function CalculateMortgage(){
var Params = {};
// select all inputs of type text
$("input:text").each(function(){
Params[$(this).attr("name")] = $(this).val();
}); // closes input:text function
// "post" the form. The Param object mimics form fields
$.post("Mortgage_Calculation.cfm", Params, function(data){
// this is the processing function.
// append what you get back to the element with ID = Result
after clearing its contents
$("#Result").empty().append(data);
} // closes post function
); // closes ( after .post
} // closes } after CalculateMortgage = function() {
} // closes the submitHandler function
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of amircx
Sent: Tuesday, March 13, 2007 8:49 AM
To: [email protected]
Subject: Re: [jQuery] forms validation error divs - help
hey rick
great job
i got some question
its works good, but if i got the same / diffrent error, its duplicates me
the error message, like "error, this field must be 15 chars at least error,
this field must be 15 chars at least error, this field must be 15 chars at
least"
and if the field is corrected or ok, its just not disappear the div error
msg... how can i fix it?
Rick Faircloth wrote:
>
> Hi, amircx...
>
> Here's some code I'm using... I just started jQuery about 2 weeks ago,
> myself.
> You'll see the rules and corresponding messages in the code.
>
> Rick
>
> $().ready(function() {
>
> // validate Mortgage_Calculation_Form form fields on keyup
> $("#MC_Form").validate({
>
> errorPlacement: function(error, element) {
>
> if(element.attr('id') == "Principal") {
> error.appendTo("#principal_error");
> }
>
> else
>
> if(element.attr('id') == "Interest") {
> error.appendTo("#interest_error");
> }
>
> else
>
> if(element.attr('id') == "Years") {
> error.appendTo("#years_error");
> }
>
> },//closes errorPlacement function
>
> focusInvalid: "false",
>
> event: "keyup",
>
> rules: {
>
> Principal: {required: true,
> digits: true},
> Interest: {required: true,
> number: true},
> Years: {required: true,
> number: true}
> },
>
> messages: {
>
> Principal: {required: "Please enter the Principal.",
> number: "Please enter a number. Format: 255000
(No $ or , )"},
> Interest: {required: "Please enter the Interest Rate.",
> number: "Please enter a number."},
> Years: {required: "Please enter the Years.",
> number: "Please enter a number."}
> },
>
>
> submitHandler: function(){
>
> // Call CalculateMortgage
> CalculateMortgage();
>
> } // closes the submitHandler function
>
> }) // closes the ) before the .validate bracket?
> }); // closes the .validate bracket
>
>
>
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>
--
View this message in context:
http://www.nabble.com/forms-validation-error-divs---help-tf3389341.html#a945
3627
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/