Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7518465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:45:15+00:00 2026-05-30T01:45:15+00:00

Attempting what would appear to be a simple pre ajax-post validation against a short

  • 0

Attempting what would appear to be a simple pre ajax-post validation against a short form. This is working correctly and posting data perfectly until adding an attempt at a conditional value check against it.

JQuery is adding the values to the form on the fly until the user changes the values in the form fields and am checking against the default values since they will be added if the user leaves blank or default.

Thoughts were to (a)do a simple conditional for #tip and #num and THEN (b)ajax post if the condition was met. Was trying to keep this simple and not use additional plugins or code.

Am I missing the obvious, or going about the this wrong way?

    function submitForm() {

    if( ($('#tip').val() != 'Enter Tip') 
            AND ($('#num').val() != 'ID number') ) {

    $.ajax({type:'POST', url:'populatedb.php', data:$('#TipForm').serialize(), success: function(response) {
    $('.formresult').html(response);
    $("#TipForm").hide();
    }});
    return false;

       } else {
            alert("Please fill all form fields");
       }

    } // end submitForm()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:45:16+00:00Added an answer on May 30, 2026 at 1:45 am

    I think you need this line

    if(($('#tip').val() != 'Enter Tip' || $('#tip').val() !='') && ($('#num').val() != 'ID number' || $('#num').val() !=''))
    

    instead of the following

    if( ($('#tip').val() != 'Enter Tip') AND ($('#num').val() != 'ID number') )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on some concurrent code that would appear to have a few
I am attempting to post form data to my app using Facebook. My form
I've been attempting to write a Lisp macro that would perfom the equivalent of
I am attempting to save an rtf file using FileDialog and would like to
I am attempting to write a cross-platform GUI application that would be deployed to
I am attempting to submit a querystring to a ColdFusion page. I would like
Attempting to use the data series from this example no longer passes the JSONLint
I am attempting to create a very simple web interface for changing some system
I am attempting to write a very simple rake task (and merge it into
I'm attempting to use a large number of short sound samples in a game

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.