You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Shuu Johnny <jo...@gmail.com> on 2013/05/01 12:25:55 UTC

tapestry 5.3.6 using autocomplete component problem

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

Re: tapestry 5.3.6 using autocomplete component problem

Posted by Emmanuel DEMEY <de...@gmail.com>.
The xsd file you are using seems wrong. Can you use
tapestry_5_3.xsd<http://tapestry.apache.org/schema/tapestry_5_3.xsd>
 instead.
I am not sure it is the solution to your problem.
Manu


2013/5/1 Shuu Johnny <jo...@gmail.com>

> 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
>



-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey