Re: JAVASCRIPT
| From: | Awlad Hussain | Date: | Fri, 07 Mar 2003 12:41:50 +0000 |
| Subject: | Re: JAVASCRIPT | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138611@lists.php.net to get a copy of this message | ||
i think you're not calling the the javascript validation function when
you're submiting the form
you need to call the function like this:
<form method="post" action="registration1.php" onsubmit="return
Field_Validator(this)">
try this code below, hope this will help
-awlad
--------------------------------
<html>
<body>
<script Language="JavaScript">
<!--
function Field_Validator(form)
{
if (form.name.value == "")
{
alert("Please fill in the name field.");
form.name.focus();
return (false);
}
return (true);
}
//-->
</script>
<form method="post" action="where_ever_you_want.htm" onsubmit="return
Blank_TextField_Validator(this)">
<p>
name
<br>
<input type="text" name="name" >
<br>
<input type="submit" value="Submit">
</form>
</body>
----- Original Message -----
From: "Diksha Neel" <diksha_neel@rediffmail.com>
To: <php-general@lists.php.net>
Sent: Friday, March 07, 2003 12:33 PM
Subject: [PHP] JAVASCRIPT
> dear all,
>
> hi!
>
> in my php script registration1.php, i have written
> javascript for form validation i.e. for checking if
> the mandatory fields are filled correctly or not.
> but on clicking the submit button, i get connected to
> the next page without the form getting validated!!
>
> i guess i have made a silly mistake somewhere but am
> not able to figure out where and what.
> attaching registration1.php.
>
> please help.
> thanks.
> regards,
> diksha.
>
>
>
>
>
>
>
----------------------------------------------------------------------------
----
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php