Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes HTML, CSS and JavaScript and the fly likes validate a ajax dropdown Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validate a ajax dropdown" Watch "validate a ajax dropdown" New topic

validate a ajax dropdown

Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47
i am creating a dropdown box using ajax.Now i want to check whether he(user) has selected value from that. i am getting object not found error, since that will be created only at runtime

-Rajesh.V<br /> Software Consultant
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
We can not read minds here. We need to see some code if you really expect us to help you out.

Normally object expected means that you are trying to reference an object that is not on the page. So that means you either are not adding it to the page correctly or referencing it before it is there.

Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47
i am sorry if i am not able to specify clearly

since "dropdownSuspType" variable is not in main page, and it comes from ajax. i am getting error

If the use is not selecting status and it's default("Please Select") is selected then i should display alert "Please select status".
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

You really shouldn't be transferring a complete select element from the server. If you already have that element on the page, and just hidden until needed, simply return the results that should be displayed as options for the select only. Populate the select with the options returned from the server.

And when I say options I don't mean return

I mean, return the value/label pairs from the server. There are examples all over the web on how to do this.

GenRocket - Experts at Building Test Data
Rajesh Veluchamy
Ranch Hand

Joined: Jan 15, 2008
Posts: 47
thanks Gregg,
Is it possible to hide a dropdown box i.e, <select></select>

Till now i know only "<input type=hidden/>"

My requirement now is, the dropdown should be visable to user only when he click one option button
Satish Chilukuri
Ranch Hand

Joined: Jun 23, 2005
Posts: 266
You can use either the CSS display or visible properties to hide/unhide an element.
I agree. Here's the link:
subject: validate a ajax dropdown
It's not a secret anymore!