Hi, all...

Using Jorn's Validation plug-in and trying
to use a submitHandler.

Firebug is giving me this error:

"CalculateMortgage is not defined"

Can someone tell me what I need to do to 
the Calculate Mortgage function to define it?

Thanks for any help!

Rick

Here's the full jQuery code involved:

<script type="text/javascript">

        $.validator.defaults.debug = true;
        $().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,
                                            number: 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(){
                                
                                    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            

        }) // closes the ) before the .validate bracket?
        }); // closes the .validate bracket
                
</script>



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to