Solved

Check for  form values

Posted on 2011-09-29
4
204 Views
Last Modified: 2012-05-12
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
Comment
Question by:gvilla23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36815890
<< 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
 

Author Comment

by:gvilla23
ID: 36816149
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
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 36816163
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
 

Author Comment

by:gvilla23
ID: 36816216
Perfect!, Thank you.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question