RE: [PHP] validate form with javascript
doh! forgot to add, you need to put this in your tage as well : name="formname" onSubmit="return formCheck()" regards /sunny -Original Message- From: Sandeep Hundal [mailto:[EMAIL PROTECTED]] Sent: 14 May 2001 10:43 To: 'Meir Kriheli - MKsoft'; Chris Mason; [EMAIL PROTECTED] Subject: RE: [PHP] validate form with javascript here's one that i use along with my forms you can ofcourse expand it to include all forms as long as you change the input names too hapy coding :) /sunny transmitted = 0; function formCheck() { if (document.formname.inputname.value == "") { alert("You need to enter an email address!"); document.formname.inputname.focus(); return false; } } -Original Message- From: Meir Kriheli - MKsoft [mailto:[EMAIL PROTECTED]] Sent: 14 May 2001 11:42 To: Chris Mason; [EMAIL PROTECTED] Subject: Re: [PHP] validate form with javascript You can try the forms class from Manuel Lemos, which handles this and more. For more details: http://phpclasses.upperdesign.com/browse.html/package/1 -- Meir Kriheli MKsoft computer systems 'There's someone in my head but it's not me" - Pink Floyd - Original Message - From: "Chris Mason" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 14, 2001 2:46 AM Subject: [PHP] validate form with javascript > I have a form in which I validate the email address using a php function > then alert the operson if the email address is not correct. However, I would > like to pop up an alert with javascript if the email field is left blank. I > am using the function below but it down't work with php, probably works > great with a cgi. > > Does anyone have a better way to do this? > > Chris Mason > Code: > in the head > > function validForm(replyForm) > { > if(replyForm.email.value==\"\"){ > alert(\"You must enter an email address\") > replyform.email.value.focus() > return false > } > return true > } > > > in the form: > ACTION=\"reserve.php3?action=send\" ENCTYPE=\"x-www-form-urlencoded\"> > > E-Mail TYPE=\"text\" NAME=\"email\" VALUE=\"$email\" SIZE=\"50\"> > > > > ") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] validate form with javascript
here's one that i use along with my forms you can ofcourse expand it to include all forms as long as you change the input names too hapy coding :) /sunny transmitted = 0; function formCheck() { if (document.formname.inputname.value == "") { alert("You need to enter an email address!"); document.formname.inputname.focus(); return false; } } -Original Message- From: Meir Kriheli - MKsoft [mailto:[EMAIL PROTECTED]] Sent: 14 May 2001 11:42 To: Chris Mason; [EMAIL PROTECTED] Subject: Re: [PHP] validate form with javascript You can try the forms class from Manuel Lemos, which handles this and more. For more details: http://phpclasses.upperdesign.com/browse.html/package/1 -- Meir Kriheli MKsoft computer systems 'There's someone in my head but it's not me" - Pink Floyd - Original Message - From: "Chris Mason" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 14, 2001 2:46 AM Subject: [PHP] validate form with javascript > I have a form in which I validate the email address using a php function > then alert the operson if the email address is not correct. However, I would > like to pop up an alert with javascript if the email field is left blank. I > am using the function below but it down't work with php, probably works > great with a cgi. > > Does anyone have a better way to do this? > > Chris Mason > Code: > in the head > > function validForm(replyForm) > { > if(replyForm.email.value==\"\"){ > alert(\"You must enter an email address\") > replyform.email.value.focus() > return false > } > return true > } > > > in the form: > ACTION=\"reserve.php3?action=send\" ENCTYPE=\"x-www-form-urlencoded\"> > > E-Mail TYPE=\"text\" NAME=\"email\" VALUE=\"$email\" SIZE=\"50\"> > > > > ") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] validate form with javascript
You can try the forms class from Manuel Lemos, which handles this and more. For more details: http://phpclasses.upperdesign.com/browse.html/package/1 -- Meir Kriheli MKsoft computer systems 'There's someone in my head but it's not me" - Pink Floyd - Original Message - From: "Chris Mason" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, May 14, 2001 2:46 AM Subject: [PHP] validate form with javascript > I have a form in which I validate the email address using a php function > then alert the operson if the email address is not correct. However, I would > like to pop up an alert with javascript if the email field is left blank. I > am using the function below but it down't work with php, probably works > great with a cgi. > > Does anyone have a better way to do this? > > Chris Mason > Code: > in the head > > function validForm(replyForm) > { > if(replyForm.email.value==\"\"){ > alert(\"You must enter an email address\") > replyform.email.value.focus() > return false > } > return true > } > > > in the form: > ACTION=\"reserve.php3?action=send\" ENCTYPE=\"x-www-form-urlencoded\"> > > E-Mail TYPE=\"text\" NAME=\"email\" VALUE=\"$email\" SIZE=\"50\"> > > > > ") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] validate form with javascript
What is the particular error you're getting? ""Chris Mason"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have a form in which I validate the email address using a php function > then alert the operson if the email address is not correct. However, I would > like to pop up an alert with javascript if the email field is left blank. I > am using the function below but it down't work with php, probably works > great with a cgi. > > Does anyone have a better way to do this? > > Chris Mason > Code: > in the head > > function validForm(replyForm) > { > if(replyForm.email.value==\"\"){ > alert(\"You must enter an email address\") > replyform.email.value.focus() > return false > } > return true > } > > > in the form: > ACTION=\"reserve.php3?action=send\" ENCTYPE=\"x-www-form-urlencoded\"> > > E-Mail TYPE=\"text\" NAME=\"email\" VALUE=\"$email\" SIZE=\"50\"> > > > > ") > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] validate form with javascript
I have a form in which I validate the email address using a php function then alert the operson if the email address is not correct. However, I would like to pop up an alert with javascript if the email field is left blank. I am using the function below but it down't work with php, probably works great with a cgi. Does anyone have a better way to do this? Chris Mason Code: in the head function validForm(replyForm) { if(replyForm.email.value==\"\"){ alert(\"You must enter an email address\") replyform.email.value.focus() return false } return true } in the form: E-Mail ") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]