Technipelago AB

Technipelago Blog Stuff that we learned...


Multiple Grails-UI AutoComplete components

Publicerad den 9 nov 2008

If you have a Grails-UI autoComplete component on a page that are dependent on another input element on the page, you can use the dependsOn=”id-of-other-element” config parameter.

Then the value of that other component will be passed in a “dependsOnValue” request parameter.

However, if the dependant element is also an autoComplete component and you want to send it’s hidden id-value in the request, you must use an alternative syntax for dependsOn.


<gui:autoComplete
  id="category"
  controller="demo"
  action="findCategories"
/>
<gui:autoComplete
  id="item"
  controller="demo"
  action="findItems"
  dependsOn="[value:’category’, label:’cat’, useId:true]"
/>

The label parameter is optional, but you can use it to change the request parameter name from “dependsOnValue” to something else (in this case ‘cat’).

This is not well documented but I found it by looking at the Grails-UI source (InputTagLib.groovy).

Tags: grails ui


« Tillbaka