Hmmm... can't get it to enable/disable the submit button at all... with
either solution.

Would the code I showed you be likely to work with this code?


<script type="text/javascript">

        function CalculateMortgage(){

            var Params = {};

            $("input:text").each(function(){
            Params[$(this).attr("name")] = $(this).val();
            });

            $.post("callpage_Validate_Mortgage_Inputs.cfm", Params,
function(data){
         
            $("#Result").empty().append(data);
            });
                        
        return false;
        }
                
                        
        $(document).ready(function(){
        
        onInvalid: function(form) {
                 $("input:submit",form).attr("disabled","disabled");
            };

                onValid: function(form) {
                 $("input:submit",form).attr("disabled","");
        
            };          
                         
        $("#Principal").blur(function(){ 
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{principal:$("#Principal").val()},
                function (data) {$("#Result_Principal").empty().append(data)
} ) });
        
        $("#Interest").blur(function(){
        $.post("callpage_Validate_Mortgage_Inputs.cfm",
{interest:$("#Interest").val()},
                function (data) {$("#Result_Interest").empty().append(data)
}) });
        
        $("#Years").blur(function(){
        
$.post("callpage_Validate_Mortgage_Inputs.cfm",{years:$("#Years").val()},
                function (data) {$("#Result_Years").empty().append(data) })
});

        $("#Calculate").click(function() { return CalculateMortgage(); });
        
        });

</script>

The submit button code is:

<INPUT ID="Calculate" Name="Calculate" Type="Submit" Value="Calculate">

Any further thoughts on how this can be done?

Thanks,

Rick


-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Sean Catchpole
Sent: Monday, April 16, 2007 1:44 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: Will this code enable & disable a submit button?


Hi Rick,

>   $(form).find("[EMAIL PROTECTED]").attr("disabled","disabled");
This should work just fine (although you are missing an ending ] ).
As a slightly shorter notation you can do:
$("input:submit",form).attr("disabled","disabled");

>   $(form).find("[EMAIL PROTECTED]").attr("disabled", "");
This should also work to enable the element, but the best test is
trial and error.

~Sean


Reply via email to