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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T02:28:18+00:00 2026-05-17T02:28:18+00:00

Now here is another problem.. my code: <script type=text/javascript> function validate_form () { if

  • 0

Now here is another problem..
my code:

<script type="text/javascript">
function validate_form ()
{


    if ( document.myform.tele_caller.value == "" )
    {
       alert ( "Please insert the Name" );
       return false;
 }
 else
 {
 return true;
 }
}
</script>

and the form-

 <form action="telecallerinfo.php?action=modify&id=<?php echo $id;?>" method="post" enctype="multipart/form-data" name="myform" 
onsubmit="return validate_form ( );">
<table class="panel1">
 <tr>
  <td align="center">Caller Name:&nbsp;
    <input name="tele_caller" type="text" size="15" value="<?php echo $tele_caller?>" /></td>
 </tr>
 <tr>
  <td align="right">
  <input name="submit" id="submit" type="image" src="images/submit.gif" width="60" onclick="this.form.submit();"/>
  <a href="telecallerinfo.php"><img src="images/cancel.gif" height="25" width="70"/></a>
  </td>
 </tr>


</table>
</form>

now the validation is called and the alert box is also being displayed but the form is still being submitted. where is the mistake?

  • 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-17T02:28:19+00:00Added an answer on May 17, 2026 at 2:28 am

    You’re manually calling the submit() here:

    onclick="this.form.submit();"
    

    Just remove that onclick handler, there’s no need for that handler, it’ll happen automatically since it’s inside the <form>.

    Here’s the comparison: your current code, with onclick (still submitting) vs. your code with onclick removed (only submitting when valid).

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

Sidebar

Related Questions

I used the code described here but now, when I do a for ...
I have a really confusing problem. I have a PHP script that polls another
I have the following code using require.js. utilities.js: define([thirdparty-script-A.js], function(){ ... }); application.js: define([utilities,
I've asked another related question to this here: casting dynamic to static problem I've
I've been developing a site (for now is here as an example: http://neurotoxine.mine.nu/gloom ),
I compute c = a 'OR' b // bitwise OR operation here Now given
I asked the question here and now i would like to reverse this procedure
i dont know if i should be asking this here (im now thinking maybe
So here is what the method looks like now: POST person/personId/edit https://api.example.com/*key*/person/*personId*/edit?FName=Blah I want
Here's how it looks like right now: my screenshot Is there a way for

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.