By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

Why is this not working???

P: 15
I have this code it works fine validates fine until i press submit and it fails

just a simple drop down box
Expand|Select|Wrap|Line Numbers
  1.  <tr>
  2.           <td><label for="subject">Subject</label></td>
  3.           <td><select name="subject" id="subject" value="<?=$_SESSION['post']['subject']?>" >
  4.  
  5.             <option value="0" selected="selected">Choose</option>
  6.             <option value="Question">Question</option>
  7.             <option value="Business proposal">Business proposal</option>
  8.             <option value="Advertisement">Advertising</option>
  9.             <option value="Complaint">Complaint</option>
  10.           </select>         </td>
  11.          <td id="subjectInfo">Subject</td>
  12.         </tr>
  13.  
  14.  
With this javascript
Expand|Select|Wrap|Line Numbers
  1.  var subject = $("#subject");
  2. var subjectInfo = $("#subjectInfo");
  3.  
  4. form.submit(function(){
  5.         if(validateName() & validateEmail() & validateSubject() & validateName() & validateName()) 
  6.             return true
  7.         else
  8.             return false;
  9.     });
  10.  
  11. function validateSubject(){
  12.         if(this.selectedIndex > 0) {
  13.                subjectInfo.text("Valid");
  14.             subjectInfo.removeClass("error");
  15.             return true;
  16.         }     
  17.         // Not valid
  18.         else{
  19.               subjectInfo.text("NOT valid");
  20.               subjectInfo.addClass("error");
  21.               return false;
  22.  
  23.   }
  24.     }
  25.  
Again it works fine up until i press submit and it goes from valid to not valid! can anyone tell me what i am not seeing??
Aug 5 '11 #1
Share this Question
Share on Google+
1 Reply


P: 15
can anyone help on this?
Aug 6 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.