You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mael Caldas <ma...@gmail.com> on 2006/08/16 20:59:36 UTC

Label on Property Selection List

Hi

I'm using tapestry 4, and have a selection list that submits the form on
change, without a button, but, when I have only one item on the list, I
can't submit the form, because, of course, there is nothing to change!

Does anybody knows a simple way to have a label inside the property
selection list, like "chose your item", in the first position of the
selection list , so, if I have only one item on the list, when I change from
"chose your item" to the "Item 1", the javascript submits the form...

Thanks!

Re: Label on Property Selection List

Posted by Mael Caldas <ma...@gmail.com>.
Thanks a lot Ryan!

That was exactly what I wanted!
:)

[]'s

Mael

On 8/16/06, Ryan Holmes <ry...@hyperstep.com> wrote:
>
> As a matter of fact, yes, there is a simple way! Excuse my
> enthusiasm, but it's not often that I get to say that on the Tapestry
> mailing list ;)
>
> You want a LabeledPropertySelectionModel, which is a simple decorator
> around your existing IPropertySelectionModel:
>
> http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/
> tapestry/form/LabeledPropertySelectionModel.html
>
>
> Inside the method that creates your IPropertySelectionModel just add
> something like:
>
> (assume your existing model is in a variable named "myModel")
> IPropertySelectionModel labeledModel = new
> LabeledPropertySelectionModel(myModel, "Choose your item");
> return labeledModel;
>
>
> -Ryan
>
> On Aug 16, 2006, at 11:59 AM, Mael Caldas wrote:
>
> > Hi
> >
> > I'm using tapestry 4, and have a selection list that submits the
> > form on
> > change, without a button, but, when I have only one item on the
> > list, I
> > can't submit the form, because, of course, there is nothing to change!
> >
> > Does anybody knows a simple way to have a label inside the property
> > selection list, like "chose your item", in the first position of the
> > selection list , so, if I have only one item on the list, when I
> > change from
> > "chose your item" to the "Item 1", the javascript submits the form...
> >
> > Thanks!
>
> Ryan Holmes, CISSP
>
> ryan@hyperstep.com
> ph. (213) 626-0026
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Label on Property Selection List

Posted by Ryan Holmes <ry...@hyperstep.com>.
As a matter of fact, yes, there is a simple way! Excuse my  
enthusiasm, but it's not often that I get to say that on the Tapestry  
mailing list ;)

You want a LabeledPropertySelectionModel, which is a simple decorator  
around your existing IPropertySelectionModel:

http://tapestry.apache.org/tapestry4/tapestry/apidocs/org/apache/ 
tapestry/form/LabeledPropertySelectionModel.html


Inside the method that creates your IPropertySelectionModel just add  
something like:

(assume your existing model is in a variable named "myModel")
IPropertySelectionModel labeledModel = new  
LabeledPropertySelectionModel(myModel, "Choose your item");
return labeledModel;


-Ryan

On Aug 16, 2006, at 11:59 AM, Mael Caldas wrote:

> Hi
>
> I'm using tapestry 4, and have a selection list that submits the  
> form on
> change, without a button, but, when I have only one item on the  
> list, I
> can't submit the form, because, of course, there is nothing to change!
>
> Does anybody knows a simple way to have a label inside the property
> selection list, like "chose your item", in the first position of the
> selection list , so, if I have only one item on the list, when I  
> change from
> "chose your item" to the "Item 1", the javascript submits the form...
>
> Thanks!

Ryan Holmes, CISSP

ryan@hyperstep.com
ph. (213) 626-0026



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