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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:11:16+00:00 2026-05-25T14:11:16+00:00

I have a form, when the user clicks on the submit button this javascript

  • 0

I have a form, when the user clicks on the submit button this javascript is ran to validate the required fields are filled out:

<script type="text/javascript">
function validateForm()
{
var x=document.forms["OrderPage"]["client_name"].value
if (x==null || x=="")
  {
  alert("Client Name is required.");
  return false;
  }
var a=document.forms["OrderPage"]["client_email"].value
if (a==null || a=="")
  {
  alert("Client Email is required.");
  return false;
  }
var b=document.forms["OrderPage"]["client_home_phone"].value
if (b==null || b=="")
  {
  alert("Client Home Phone is required.");
  return false;
  }
var c=document.forms["OrderPage"]["site_street"].value
if (c==null || c=="")
  {
  alert("Site Street is required.");
  return false;
  }
}
</script>

What I am trying to add now is javascript to auto-submit the form every 10 min, but I want to make sure that it validates those required fields are filled in, otherwise I don’t want the form to be submitted, and I want the alert to pop up. I have the following code, and it is submitting the form, but it doesn’t call the function to validateForm:

<SCRIPT LANGUAGE="JavaScript"><!--
setTimeout('document.OrderPage.submit()',50000);
//--></SCRIPT>

And this is my button on the page, where if the user clicks it, it calls the function to validate those fields:

<form name="OrderPage" action="save_client_information.php" onsubmit="return validateForm()" method="post">

<input name="save_client_info" type="submit" value="Save" />

Any help combining the functions to auto-save and validate the form would be greatly appreciated! Thank you!

  • 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-25T14:11:17+00:00Added an answer on May 25, 2026 at 2:11 pm

    Why submit at all at given interval. Why not just call validate method at interval.

    setInterval(validateForm,50000);
    

    Ensure setInterval method is paused when it is already validating, otherwise you will see lot of annoying alert messages

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

Sidebar

Related Questions

I have a form with a Clear button. When the user clicks Clear, I
I have a form containing only select fields, a submit button and a reset
When a user have changed something in a form, then clicks on any link
I have a remote_form which works 100% When a user clicks submit, it goes
I have a form a user can enter their name, then it will add
On a website if I have a form where the user can input some
I have a form which takes both the user details and an image uploaded
We have a form that allows a user to filter a list with by
I have a form in which the user can choose a component type from
I have a form on a page where the user has inputs to edit

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.