views:

41

answers:

1

Hey I am learning Grails. I've been playing with it for a while but nothing too serious. And let's say I have two drop down boxes, one with the type of animal and the second with the breed. How do I give the second box the values?? For example, If I select dog, it should only show me dog breeds, not the cat ones.

Thanks in advance.

+3  A: 

One way is to use AJAX to do this (if you don't mind making a server call each time you change the selection on the first dropdown). Take a look here:

http://www.grails.org/AJAX-Driven+SELECTs+in+GSP

Javid Jamae
What do you mean by server call??
fgualda87
AJAX stands for Asynchronous Javascript and XML. What this means is that the browser will make an asynchronous call (without reloading the page on the browser) to the web server to load some data (usually passed back as XML or JSON). After loading the data, it will update the page (again, without reloading). You can use a tool like Fiddler to actually see the traffic going across the wire from the browser to the server.
Javid Jamae
I have a question though... It talks about two domains... Should they be on the same file or different files??
fgualda87
They should be in different files.
Javid Jamae