User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,780 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,513 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 477 | Replies: 2
Reply
Join Date: Oct 2007
Location: Penang Island, Malaysia
Posts: 165
Reputation: lordx78 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
lordx78's Avatar
lordx78 lordx78 is offline Offline
Junior Poster

Validation

  #1  
Apr 17th, 2008
Hi,

How to this type of validation using JavaScript?
Scenario
In my SEARCH page, user was given 5 types of field(drop-down menu) to choose from. User can select either 1, 2,3,4 or all the field's option to make a search. I know how to do validation field by field(need to fill in the previous field before use can proceed to the next field), but I don't know how to write a JSript to alert " None of the field chosen! " and if at least ONE of the field is chosen, then the user can submit his/her search. Please advise.
Last edited by lordx78 : Apr 17th, 2008 at 1:28 pm.
"I might not be the BEST but I'm not like the REST!"
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 10
Reputation: swingingstars is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
swingingstars swingingstars is offline Offline
Newbie Poster

Re: Validation

  #2  
Apr 18th, 2008
okay, this has similar task with my current site programming.. this is how i do :

- Enable the first select box and DISABLE the rest.
- on the first select box, use onChange or onBlur property to call an ajax request. The request result would be innerHTML of the second select box (enabled and has onChange or onBlur property to call an ajax request to populate the third)
- the submit button has onSubmit property. This onSubmit will get the first, second, third, etc .. Values.. Depending on your needs.. validate with IF ELSE function.. if one of them or all of them is true or not blank, then call a function again to make the actual form submit.

It works just fine. Maybe others has a sample code for this. I don't have much time now, maybe later.

by the way, if you want to use an easy way to validate your forms, you can try livevalidation
Reply With Quote  
Join Date: Oct 2007
Location: Penang Island, Malaysia
Posts: 165
Reputation: lordx78 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
lordx78's Avatar
lordx78 lordx78 is offline Offline
Junior Poster

Re: Validation

  #3  
Apr 18th, 2008
Thanks for your advise, will follow and update here soon.
"I might not be the BEST but I'm not like the REST!"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:55 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC