You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Chris Cureau <cm...@gmail.com> on 2012/04/22 09:21:04 UTC

Autocomplete mixin in a beaneditor

I've been trying to add my own parameters to a beanedit to get the
autocomplete mixin to work, but I'm having little luck.  Is this possible?
 I added a println to the java code for the provideCompletions, but it
doesn't seem that the method is ever getting called...

AddressAdd.tml:
<t:form t:id="form" clientValidation="false">
<div t:type="beanEditor" object="zipCode">
<p:name>
<t:label for="zcode" />
<t:textfield t:id="zcode" t:mixins="Autocomplete"
t:value="zipCode.code" translate="zipcode" />
</p:name>
</div>
        </t:form>

AddressAdd.java
@OnEvent(value = "provideCompletions")
List<String> zcode(String partial) {
List<String> result = new ArrayList<String>();
List<ZipCode> matches = zipCodeDAO.findByPartialZipCode(partial);
 for (ZipCode z : matches) {
result.add(z.getCode());
}
System.out.println("\n\nin completions\n\n");
return result;
}

Re: Autocomplete mixin in a beaneditor

Posted by bdm <bd...@imageau.eu>.
Hello,
I have got exactly the same pbm. Even the generated html does not contain
any reference to autocomplete stuffs ... Seems, I missed something but I
don't get it :(

have you find a solution ?

Thx,
BDM.

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Autocomplete-mixin-in-a-beaneditor-tp5657118p5713796.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Autocomplete mixin in a beaneditor

Posted by bdm <bd...@imageau.eu>.
OK ... I get it working but not completely! Here is the solution working for
me:


But, in the previous piece of code I can not have my entity field (named
'model') working because of this error: 


It seems there is a confusion between the field 'model' from the
BeanEditForm and mine ... How could I solve that ?

Thanks !!

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Autocomplete-mixin-in-a-beaneditor-tp5657118p5713834.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Autocomplete mixin in a beaneditor

Posted by Chris Cureau <cm...@gmail.com>.
The only way I got it to work was to leave the field out of the beaneditor
and present it as a normal textfield. If you're using the default template,
use a div type of beaneditor-row and it all looks uniform.
On Apr 22, 2012 2:21 AM, "Chris Cureau" <cm...@gmail.com> wrote:

> I've been trying to add my own parameters to a beanedit to get the
> autocomplete mixin to work, but I'm having little luck.  Is this possible?
>  I added a println to the java code for the provideCompletions, but it
> doesn't seem that the method is ever getting called...
>
> AddressAdd.tml:
> <t:form t:id="form" clientValidation="false">
> <div t:type="beanEditor" object="zipCode">
>  <p:name>
> <t:label for="zcode" />
> <t:textfield t:id="zcode" t:mixins="Autocomplete"
>  t:value="zipCode.code" translate="zipcode" />
> </p:name>
>  </div>
>         </t:form>
>
> AddressAdd.java
> @OnEvent(value = "provideCompletions")
>  List<String> zcode(String partial) {
> List<String> result = new ArrayList<String>();
>  List<ZipCode> matches = zipCodeDAO.findByPartialZipCode(partial);
>  for (ZipCode z : matches) {
> result.add(z.getCode());
> }
>  System.out.println("\n\nin completions\n\n");
> return result;
> }
>
>
>
>