• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 208
  • Last Modified:

Check for form values

I need to display a submit button once values are provided in the required form fields.

Required fields are Name, Title and a Radio button checked.

 I can make it work with the radio button but not the  Name and Title.
  

 jQuery('#agree').click(function() {
 if (! jQuery("input[@name='agree']:checked").val()       ) {
       
        return false;
    }
    else {
       jQuery("#submit").fadeIn();
    }
  });

Open in new window


All I want to do is once all 3 fields have a value, fade in the submit button.

Thanks,
0
gvilla23
Asked:
gvilla23
  • 2
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
<< Required fields are Name, Title and a Radio button checked. >>

so the ID of this fields are : Name, Title and Radio

 jQuery('#Name,#Title,#Radio').change(function() {
        if( $("#Name").val().length != 0 && $("#Title").val().length !=0 && $("#Radio").is(":checked") ){
              jQuery("#submit").hide();
        }
        else {
              jQuery("#submit").fadeIn();
        }
});
0
 
gvilla23Author Commented:
it fades in the submit button when any one of the three fields has a value, I need the submit button to fade in when all the fields have a value.

Here is the code,

  jQuery('#submitName,#title,#agree').change(function() {
        if(jQuery("#submitName").val().length != 0 && jQuery("#title").val().length !=0 && jQuery("#agree").is(":checked") ){
              jQuery("#submit").hide();
        }
        else {
              jQuery("#submit").fadeIn();
        }
});

Thank you,
0
 
leakim971PluritechnicianCommented:
so :

jQuery('#submitName,#title,#agree').change(function() {
        if(jQuery("#submitName").val().length != 0 && jQuery("#title").val().length !=0 && jQuery("#agree").is(":checked") ){
              jQuery("#submit").fadeIn();
        }
        else {
              jQuery("#submit").hide();
        }
});
0
 
gvilla23Author Commented:
Perfect!, Thank you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now