•
•
•
•
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
![]() |
•
•
Join Date: Oct 2007
Location: Penang Island, Malaysia
Posts: 165
Reputation:
Rep Power: 1
Solved Threads: 2
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.
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!"
•
•
Join Date: Apr 2008
Posts: 10
Reputation:
Rep Power: 1
Solved Threads: 1
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
- 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
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
Similar Threads
- .net validation/javascript conflict (ASP.NET)
- W3C Validation (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: viewing html source from javascript
- Next Thread: How to fill the content with Ajax AFTER page fully loaded


Linear Mode