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 3990834
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:32:33+00:00 2026-05-20T06:32:33+00:00

Currently I have a set of fields on a page. When the button is

  • 0

Currently I have a set of fields on a page. When the button is clicked, and the validation for these fields pass, a dialog modal box will appear. This box has a few other fields that must be filled in before the form can be submitted.

How can I show that the first set of fields are validate and open the dialog with out submitting the form until the dialog fields have also been validated?

$( "#check-button" )  
    .button()  
    .click(function(e) { 
         // Section 1 
         $(':text, select, textarea').each(function() {  
             if ($(this).val().length == 0) {  
                     $(this).css('border', '2px solid red');  
                     e.preventDefault();  
             }  
         });  

         //Section 2
         //e.preventDefault();
         //$('#my_form').submit();
         //$( "#dialog-form" ).dialog( "open" );
});

I have tried commenting both above sections out. Section 1 leaves everything highlighted and does not submit my form. Section 2 submits my form with out the second items being validated. The inputs for both sections are part of the same form. Please let me know if there is something else I should explain about this situation.

In summary, I am looking for a way to validate each item based on id and once the first set has passed, open the dialog, allow the user to enter in the second set and validate the second set of fields. Finally, submitting the form.

Thank you in advance for any guidance.

  • 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-20T06:32:34+00:00Added an answer on May 20, 2026 at 6:32 am

    One way of doing this is to just create a validate function and return true; if all fields look good, otherwise return false; …if it returns true, then you show the dialog box.

    A quick example for you (I made my own variation, but you should get the idea): http://jsfiddle.net/iwasrobbed/acU4Q/1/

    By the way, if you’re checking for 0 length on the field, make sure you use trim() so you remove any whitespaces. The way you currently have it, pressing the spacebar once will actually mean the input is valid even though the field is blank.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have speakers set up both in my office and in my living
Currently I have subversion set up so that when I make changes in Eclipse
I currently have CruiseControl.NET set up with SVN to automatically grab the code source
I currently have my PHP class variables set up like this: class someThing {
Currently I have a root-level repository set up for each project, like so: Project1
I have an ASP.NET page that contains two div's. Both have search fields and
I have a pretty standard table set-up in a current application using the .NET
I use bzr for websites. I have all my current ones set up so
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have an existing database and I am using the LINQtoSQL generator tool

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.