tags:

views:

285

answers:

2

I'm programming a page that uses the grails-ui plugin "autocomplete" feature. It doesn't work and the error console shows the error "YAHOO is not defined"; searching the web I tried the following:

  • Install the yui2 ad 3 plugins
  • Uninstall the grails-ui plugin
  • reinstall the grails-ui plugin

With no luck.

Any ideas ? I'm using grails 1.2

Here's my gsp:

<%@ page contentType="text/html;charset=UTF-8" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<gui:resources components="autocomplete" />
<title>Sample title</title>
</head>
<body>
<h1>Sample line</h1>
<g:form action="autoespec" id="id1">
<gui:autoComplete
    id="spec"
    name="spec"
    resultName="result"
    labelField="name"
    idField="id"
    controller="inscripcion"
    action="autoespec"
/>

  <input type="text" name="query">
  <input type="submit">
</g:form>
</body>
</html>

Added an input to check that the controller worked (it does).

A: 

It appears that you've got the tag namespaces wrong. Assuming you're using the latest richui plugin from http://www.grails.org/RichUI+Plugin and installed it using grails install-plugin richui you need the following tags:

<resource:autoComplete skin="default"/>

in the page head and for the autocomplete box itself:

<richui:autoComplete ...  />

I also notice that the attributes you're using for the riuchui:autocomplete element are not in the documentation so you might want to give it another read: http://www.grails.org/RichUI+Plugin#AutoComplete

HTH

Dave
Actually I'm using the grails-ui plugin (which uses the gui tags), not the rich-ui one, but I'll give the latter a try.
xain
It worked right away with richui!. The only thing is that it shows only one result at a time. How do you tell it to show a list ?
xain
the maxResultsDisplayed attribute controls the number of items in the list but it should just work. More likely your controller is not sending the correct data back. If in doubt, post another question!
Dave
A: 

You have to add a special class to your body.

<body class="yui-skin-sam">
   ...
Steven Sproat