form blnak field
1 posts in topic
Flat View  Flat View

Posted By:   trushar_shah
Posted On:   Monday, April 9, 2001 05:03 AM

I am trying for a java script that prompts the user for not to leave the some form fields blank.for that I wrote a script which alerts the user that he has left the particular field blank but when I click on OK on the alert the form is submitted. I wrote return false;in the script also for the blank fields then also this problme arises so kindly give me answer as soon as possible.

Re: form blnak field

Posted By:   Aaron_Keane  
Posted On:   Friday, October 19, 2001 12:30 AM


this is something that I have validating a form, I'm sure that it could be done better (rush job) but it works!!
The function is called isSelected(), and you can see all the names of my form fields in the if statement.
My else statement (which is not pasted here) passes the focus to another function which validates the email address entered and then submits the form.

Hope that this is of some use.

function isSelected()
if ((purDetail.fname.value.length == 0)
||(purDetail.lname.value.length == 0)||
(purDetail.email.value.length == 0)||
(purDetail.email1.value.length == 0)||
(purDetail.add1.value.length == 0)||
(purDetail.city.value.length == 0)||
(purDetail.country.value.length == 0)||
(purDetail.ccnum.value.length == 0)||
(purDetail.recip.value.length == 0)||
(purDetail.phone.value.length == 0))
alert("Please ensure that you entered data in all fields marked ' * '.");

About | Sitemap | Contact