You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gunnar Eketrapp <gu...@gmail.com> on 2012/03/03 16:32:00 UTC
Forms plus none tapestry fields
Hi!
I have a form field where users can select a number of lists or individual
members that e.g. should receive a meeting invitation.
My first solution was based on jquery-ui autocomplete but I cant get that
to work in IE. (Even jquery's autocomplete examples does not work in IE.)
I then found and wanted to try Erich Hynd's jquery multi select. See
http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
My first attempt was to just add a tml generated <select> to my tapestry
form. (+ some js)
I.e. I intended to get / set a string encoded value with selected items by
myself.
However when submitting the form I got a stacktrace ...
Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not
find a coercion from type java.lang.String to type
utskicket.model.entity.MemberList.
at
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.findOrCreateCoercion(TypeCoercerImpl.java:276)
~[tapestry-ioc-5.3.1.jar:na]
at
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.access$000(TypeCoercerImpl.java:38)
~[tapestry-ioc-5.3.1.jar:na]
at
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.getCoercion(TypeCoercerImpl.java:94)
~[tapestry-ioc-5.3.1.jar:na]
at
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl$TargetCoercion.coerce(TypeCoercerImpl.java:71)
~[tapestry-ioc-5.3.1.jar:na]
at
org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:147)
~[tapestry-ioc-5.3.1.jar:na]
at $TypeCoercer_1ab47ed4cd58.coerce(Unknown Source) ~[na:na]
at
org.apache.tapestry5.internal.services.TypeCoercedValueEncoderFactory$1.toValue(TypeCoercedValueEncoderFactory.java:45)
~[tapestry-core-5.3.1.jar:na]
at
org.apache.tapestry5.corelib.components.Loop.restoreStateFromStoredClientValue(Loop.java:470)
~[tapestry-core-5.3.1.jar:na]
at org.apache.tapestry5.corelib.components.Loop.access$500(Loop.java:64)
~[tapestry-core-5.3.1.jar:na]
at
org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:185)
~[tapestry-core-5.3.1.jar:na]
at
org.apache.tapestry5.corelib.components.Loop$RestoreStateFromStoredClientValue.execute(Loop.java:174)
~[tapestry-core-5.3.1.jar:na]
at
org.apache.tapestry5.corelib.components.Form.executeStoredActions(Form.java:661)
~[tapestry-core-5.3.1.jar:na]
... 83 common frames omitted
So it seams like T5 does not like it that way!
Is there an easy way around this !?
Thanks in advance,
Gunnar Eketrapp
The selected data where assembled correctly by the
jquery-ui-multiselect-widget an delivered as
invited=L3,M4,M2
I.e. L<id> for selected lists and M<id> for selected members.
Extract from my bad .tml (The invited value is a String) Note: Select is
not a T5 select :
<select id="invited" name="invited" size="10" multiple="multiple"
style="width:400px;">
<optgroup label="Lists">
<t:loop source="lists" value="list">
<option value="L${list.id}">${list.name}</option>
</t:loop>
</optgroup>
<optgroup label="Members">
<t:loop source="members" value="member">
<option value="M${member.id}">${member.name}</option>
</t:loop>
</optgroup>
</select>
Re: Forms plus none tapestry fields
Posted by Gunnar Eketrapp <gu...@gmail.com>.
Thanks for the tip!
That component looks awsame and I made a test and compare it with Erich
Hynd's multiselect which also is god.
I ran into some javascript issues in my minimal test page that I will try
to solve this evening.
It was some god old conflict between prototype / jquery but I think.
I'll get back with more info if I don't solve it.
I dont use tapestry-jquery but perhaps i should ... what does it do?
Now I just include jquery js files in my layout template.
A general question regarding js @Import ...
If using @Import how is dependencies and js include ordering handled.
I.e. AutoComplete imports tokeinput js which depends on jquery js.
@SupportsInformalParameters
@Import(library = "jquery.tokeninput.js", stylesheet = "token-input.css")
public class AutoComplete extends AbstractField {
...
/Gunnar
--
[Hem: 08-715 59 57, Mobil: 0708-52 62 90]
Allévägen 2A, 132 42 Saltsjö-Boo
Re: Forms plus none tapestry fields
Posted by Lance Java <la...@googlemail.com>.
Taha has done a blogpost on a component that sounds like what you are
looking for.
In this blogpost (
http://tawus.wordpress.com/2011/12/28/multivalue-autocomplete-for-tapestry)
he creates a component based on this library
http://loopj.com/jquery-tokeninput/
Cheers,
Lance.
On Saturday, 3 March 2012, Thiago H. de Paula Figueiredo <th...@gmail.com>
wrote:
> On Sat, 03 Mar 2012 12:32:00 -0300, Gunnar Eketrapp <
gunnar.eketrapp@gmail.com> wrote:
>
>> Hi!
>
> Hi, Gunnar!
>
>> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not
>> find a coercion from type java.lang.String to type
>> utskicket.model.entity.MemberList.
>
> I guess the problem itself is that you're putting a Loop inside a Form
without setting Loop's parameter formState to none. Another solution, maybe
closer to solving your problem, is to provide a ValueEncoder for your
MemberList class.
>
> --
> Thiago H. de Paula Figueiredo
> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
> Owner, Ars Machina Tecnologia da Informação Ltda.
> http://www.arsmachina.com.br
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Forms plus none tapestry fields
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 03 Mar 2012 12:32:00 -0300, Gunnar Eketrapp
<gu...@gmail.com> wrote:
> Hi!
Hi, Gunnar!
> Caused by: org.apache.tapestry5.ioc.util.UnknownValueException: Could not
> find a coercion from type java.lang.String to type
> utskicket.model.entity.MemberList.
I guess the problem itself is that you're putting a Loop inside a Form
without setting Loop's parameter formState to none. Another solution,
maybe closer to solving your problem, is to provide a ValueEncoder for
your MemberList class.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org