Welcome to Dream.In.Code
Become an Expert!

Join 150,018 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,481 people online right now. Registration is fast and FREE... Join Now!




Combo box validation..kinda advance

 
Reply to this topicStart new topic

Combo box validation..kinda advance

lilygrace
12 Dec, 2006 - 12:09 AM
Post #1

D.I.C Head
**

Joined: 17 Aug, 2005
Posts: 89


My Contributions
how am I going to validate a combo box if the populating of datas were being generate by the Javascript.

Let's have the code

this is my selection

CODE


<select id="parentCustomer" name="parentCustomer" onChange="returnParentCustomerCode(); getInterCompanyNumber(this, parentCustomers); getNumber(this, parentCustomers); returnInheritedValues();">
                            <option value=""></option>
                          < /select>


but the population is using javascript newArray(). Now my validation is when there's no option selected. That's where I hang... I don't know what to do.

Please help me. Thanks in advance.

This post has been edited by lilygrace: 12 Dec, 2006 - 02:17 AM
User is offlineProfile CardPM
+Quote Post

Arbitrator
RE: Combo Box Validation..kinda Advance
16 Dec, 2006 - 06:05 AM
Post #2

D.I.C Regular
Group Icon

Joined: 26 Jan, 2005
Posts: 492



Thanked: 2 times
My Contributions
Assuming that “no option selected” means that the option selected has no value, I believe that the following would work: if (!document.getElementById("parentCustomer").value) { }.

The above code tests the select element for a value. If the value does not exist, then the if statement is true.

Keep in mind that something like <option selected>foo</option> still has a value. The value defaults to the content of the option element when the value attribute is not defined.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 09:12PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month