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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:07:16+00:00 2026-06-11T23:07:16+00:00

Hi I want to validate the field values before submit the form here is

  • 0

Hi I want to validate the field values before submit the form here is my code

<table width="600" border="0" align="left">
<tr>
<script type="text/javascript">
function previewPrint()
{

var RegNumber = document.getElementById('PP_RegNoTextBox').value;
var PassportNo = document.getElementById('PP_PassportNoTextBox').value;
if (RegNumber=="")
{
    alert("Please enter your Reg No.!");
    document.getElementById('RegNoTextBox').focus();
    return false;
}
if (PassportNo=="")
{
    alert("Please enter your Passport No.!");
    document.getElementById('PassportNoTextBox').focus();
    return false;
}
    //window.open('regformview.php?RegNumber=RegNumber');
    }
    </script>
<form name="ppform" onSubmit="return previewPrint();" method="post" action="regformview.php">   
<td width="100" align="LEFT" class="font8">&nbsp; </td>
<td width="337" align="LEFT" class="font8"><u>Preview your Application:</u> Please provide requested details.<br>
  Reg No.: <input type="text" name="printregno" id="PP_RegNoTextBox" class="input2"> Passport No.:  <input type="text" name="printemail" class="input2"><input type="hidden" name="flagging" id="PP_PassportNoTextBox" value="1" class="input2">&nbsp;</td>
<td width="50" align="LEFT" class="font8"><div style="float:left; background-image:url(images/printPreview1.jpg); background-repeat:no-repeat;">   
  <input type="image" src="images/printPreview1.jpg" name="ppbutton" value="" onMouseOver="this.src='images/printPreview2.jpg'" onMouseOut="this.src='images/printPreview1.jpg'"></div></td>

</form>
   </tr>
</table>

Problem is its showing the alert box correctly if it blank but the page is navigating to regformview.php after submitting. How to navigate to regformview.php only after validation.?

  • 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-11T23:07:18+00:00Added an answer on June 11, 2026 at 11:07 pm

    These are undefined:

    document.getElementById('RegNoTextBox').focus();
    document.getElementById('PassportNoTextBox').focus();
    

    it should be:

    document.getElementById('PP_RegNoTextBox').focus();
    document.getElementById('PP_PassportNoTextBox').focus();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to validate if the field really exist in the table in the
I'm trying to validate some of the field in my form. and I want
I need to validate a field as a Zip code and I want to
I have a ComboBox bound to a table field and I want to validate
I want to validate the input field 'putime' in the form because even if
I want to validate a form fields (text) input. It should only be a
I want to validate a condition before doing the next step, but only raise
I'm trying to validate my inputs with jQuery before a form is sent. This
I have a class Employee. I want to be able to Validate() it before
i have a form which i want to be validated with javascript before submitting.

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.