Jump to content

Input text validation


f.ismayil

Recommended Posts

I have the following code for validation of input text:

 

<?php

echo "<form method='POST' action='oversikt.php' onsubmit='return checkform(this);'>";

echo "<input type=text name=A2>";

echo "</form>";

?>

 

<script language="JavaScript" type="text/javascript">

<!--

function checkform ( form )

{

  // see http://www.thesitewizard.com/archive/validation.shtml

  // for an explanation of this script and how to use it on your

  // own website

 

  // ** START **

  if (form.A2.value == "") {

    alert( "Please, fill in all required fields" );

    form.A2.focus();

    return false ;

  }

  // ** END **

  return true ;

}

//-->

</script>

 

When user don't type text in A2 textbox user receives a notification but after clicking OK, page forwards user into oversikt.php. What I need is not to change URL of current page if user doesn't type text in textfield.If he typed text in textboxe to change URL into oversikt.php

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.