You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/10/10 16:48:49 UTC
T5: any simple code for this select?
Hi,
I have this dropdown box in a html form:
<select name="profile" size="1" id="profile">
<option value="T">Teacher</option>
<option value="S">Student</option>
</select>
Now I likt to use this with T5, any sample code for this? I have checked the
HowTos, all are long codes, any simplier ones? my need is simple: how to
declare this in a template and how to retrieve the value in the page class
side, thanks.
A.C.
--
View this message in context: http://www.nabble.com/T5%3A-any-simple-code-for-this-select--tf4601327.html#a13137397
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: T5: any simple code for this select?
Posted by Marcus <mv...@gmail.com>.
Hi Angelo,
Profile.java:
----------------
public enum Profile {
T, S;
}
Pagina.properties:
------------------------
T=Teacher
S=Studend
Pagina.java:
-----------------
public class Pagina {
@Persist
private Profile _profile;
public Profile getProfile() { return _profile; }
public void setProfile(Profile profile) { this._profile= profile; }
public void onSubmit() {
String profile = this.getProfile().toString(); // Getting selected
option.
System.out.println(profile);
}
}
Pagina.html:
------------------
<select t:type="Select" t:id="profile" value="profile" />
Marcus
Re: T5: any simple code for this select?
Posted by lasitha <la...@gmail.com>.
On 10/16/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> lasitha wrote:
> >
> > If you really want your values to be different from the labels ('S'
> > instead of 'Student'), you can use a Map<String, String>...
> >
>
> Now I really need something like that, can you show me a simple example?
Josh recently posted a code snippet:
http://article.gmane.org/gmane.comp.java.tapestry.user/54117
The thread itself isn't all that relevant, but hopefully the code
snippet will get you started.
Cheers,
lasitha.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: any simple code for this select?
Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Lasitha,
Now I really need something like that, can you show me a simple example?
thanks.
lasitha wrote:
>
> If you really want your values to be different from the labels ('S'
> instead of 'Student'), you can use a Map<String, String> for your
> model. The value submitted back into your 'profile' variable will be
> the corresponding map key (T or S).
> Cheers, lasitha.
>
> On 10/10/07, Josh Canfield <jo...@thedailytube.com> wrote:
>> How about something like:
>>
>> <t:select t:id="profile" model="'Teacher,Student'"/>
>
--
View this message in context: http://www.nabble.com/T5%3A-any-simple-code-for-this-select--tf4601327.html#a13235163
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: T5: any simple code for this select?
Posted by lasitha <la...@gmail.com>.
If you really want your values to be different from the labels ('S'
instead of 'Student'), you can use a Map<String, String> for your
model. The value submitted back into your 'profile' variable will be
the corresponding map key (T or S).
Cheers, lasitha.
On 10/10/07, Josh Canfield <jo...@thedailytube.com> wrote:
> How about something like:
>
> <t:select t:id="profile" model="'Teacher,Student'"/>
>
> You will get "Teacher" or "Student" back as the value, you can just
> translate it to T/S on the server...
>
> Josh
>
> On 10/10/07, Angelo Chen <an...@yahoo.com.hk> wrote:
> >
> >
> > Hi,
> >
> > I have this dropdown box in a html form:
> >
> > <select name="profile" size="1" id="profile">
> > <option value="T">Teacher</option>
> > <option value="S">Student</option>
> > </select>
> >
> > Now I likt to use this with T5, any sample code for this? I have checked
> > the
> > HowTos, all are long codes, any simplier ones? my need is simple: how to
> > declare this in a template and how to retrieve the value in the page class
> > side, thanks.
> > A.C.
> >
> >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/T5%3A-any-simple-code-for-this-select--tf4601327.html#a13137397
> > 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
> >
> >
>
>
> --
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: T5: any simple code for this select?
Posted by Josh Canfield <jo...@thedailytube.com>.
How about something like:
<t:select t:id="profile" model="'Teacher,Student'"/>
You will get "Teacher" or "Student" back as the value, you can just
translate it to T/S on the server...
Josh
On 10/10/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
>
> Hi,
>
> I have this dropdown box in a html form:
>
> <select name="profile" size="1" id="profile">
> <option value="T">Teacher</option>
> <option value="S">Student</option>
> </select>
>
> Now I likt to use this with T5, any sample code for this? I have checked
> the
> HowTos, all are long codes, any simplier ones? my need is simple: how to
> declare this in a template and how to retrieve the value in the page class
> side, thanks.
> A.C.
>
>
>
> --
> View this message in context:
> http://www.nabble.com/T5%3A-any-simple-code-for-this-select--tf4601327.html#a13137397
> 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
>
>
--
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.