When I want to do the tapestry autocomplete example, I face these trouble.

------------------------start-------------------------
An unexpected application exception has occurred.

Method
example.hellotapestry.pages.AutoCompleteComp.onProvideCompletionsFromCompInput(java.lang.String)
references component id 'CompInput' which does not exist.

-----------------------end---------------------------

the using tapestry version is 5.3.6.
the using jars is:

the java code is :

------------------------------start------------------------------------
package example.hellotapestry.pages;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;

public class AutoCompleteComp {


    @Property
    private String component;

    private List<String> components;


    List<String> onProvideCompletionsFromCompInput(String key) {

           List<String> matches = new ArrayList<String>();

           Iterator<String> it=components.iterator();
           while (it.hasNext())
           {
               String element = it.next();
               if (element.startsWith(key))
               {
                   matches.add(element);
               }
           }

           return matches;
      }


     public void pageLoaded(){

         components = new ArrayList<String>();
         components.add("AbstractField");

     }
}
------------------end------------------------------------
the tml is :
-----------------------start-------------------------------
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3_6.xsd";>
<form >
<input t:type="textfield" type="input"  t:value="component"
              t:id="compInput" t:mixins="autocomplete" />
 </form>
 </html>
-------------------end-----------------------------------

And when I remove t:mixins="autocomplete" in

<input t:type="textfield" type="input"  t:value="component"
              t:id="compInput" t:mixins="autocomplete" />

and comment out the method  onProvideCompletionsFromCompIn
put(String key)  in Java code.
Then  run the application, the testField could be rendered well.
 It seems the autocomplete don't work.....

Have I missed on something here?

Thanks in advance.

/Johnny

Reply via email to