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

  • SEARCH
  • Home
  • 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 8537107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:49:09+00:00 2026-06-11T10:49:09+00:00

I have a <form> Its default property is submitted=false; and I have a statement

  • 0

I have a <form> Its default property is submitted=false; and I have a statement

function checking() {
    var empty = 0;
    $('input[type=text]').each(function(){
       if (this.value == "") {
           empty++;
           $("#error").show('slow');
       }else{
         //missing piece
       }
    })

So when the user clicks the button and the above statement is not satisfied, I want to add onsubmit="submitted=true;" in my <form> and make it something like this <form onsubmit="submitted=true;".

  • 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-06-11T10:49:10+00:00Added an answer on June 11, 2026 at 10:49 am

    If I don’t get you wrong, you want to run that check and if it went well you want to set a variable named submitted to TRUE, and set it to FALSE otherwise.

    If so, you could do it this way:

    function checking() {
       var empty = 0;
       $('input[type=text]').each(function(){
          if (this.value == "") {
              empty++;
               $("#error").show('slow');
          }
       });
       if(empty > 0) submitted = false;
       else          submitted = true;
    }
    

    If that’s not the case. If you wanted to show an error if there’s an empty field and prevent the form from submitting if there’s an empty field, so you should do it this way:

    function checking() {
       var empty = 0;
       $('input[type=text]').each(function(){
          if (this.value == "") {
              empty++;
              $("#error").show('slow');
          }
       });
       return empty == 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.Net Page, aspx with its default form. I have a Submit
I have a form which POST's its data via AJAX: $.ajax({ type: POST, url:
I have a form named reg.php and its action is reg.php , i want
I have a form with most of its functionality implemented using standard TAction. I
I have a form field which requires a json object as its value when
I have a form, and want to disable/enable its submit button depending on whether
i have a web form and i want to change its titles for each
I have an html form. I need to send its data to flash on
I have a LWUIT Form which has 3 containers, each with its own content.
I'm trying to create a node form for a custom type. I have organic

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.