The default for the value parameter, on many components, is a property of the container whose property name matches the component id ... if such a property exists. Thus <select t:id="color"/> is virtually the same as <select value="color"/>. This is to encourage people to give their form control components, such as Select and TextField, and explicit id (this is always easier to debug on both the client and on the server) without forcing them to enter the same string ("color", in this example) repeatedly. It's slightly confusing in the short term, but I think a real win once you are aware of it.
The value parameter is still required, and you'll get an error if no matching property exists in the container. If the property exists, Tapestry binds the value to the property. On Wed, Apr 2, 2008 at 7:13 AM, Adam Zimowski <[EMAIL PROTECTED]> wrote: > In regards to your "color" example, the reason you're getting an error > is likely due to missing required parameter. If you look at component > reference for Select, you'll see that besides "model", another > required parameter is "value". The example on the website is somewhat > flawed because it is incomplete as it doesn't include value parameter > and thus it mislead you. Try this: > > > <t:select t:id="color" > model="literal:FF0000=Red,00FF00=Green,0000FF=Blue" > t:value="literal:FF0000"/> > > Now, the value above is a very naive implementation which always > selects color red. Almost certainly you want a property in your page > which manages this value, so your example more realistically would be: > > > <t:select t:id="color" > model="literal:FF0000=Red,00FF00=Green,0000FF=Blue" > t:value="selectedColor"/> > > and in your page class you'd have > > @Property > private String _selectedColor; > > Now, when form with dropdown is submitted, your _selectColor member > will have a value you selected and submitted. Anyway, the example on > Tapestry website should probably be enhanced to mention value > parameter. > > In regards to your question #2, above explanation of _selectedColor > property should give you the answer. > > -adam > > > > > On Wed, Apr 2, 2008 at 7:12 AM, Tomasz Dziurko <[EMAIL PROTECTED]> wrote: > > Hi. > > > > Currently I am working on project using Tapestry 5. I need to use > > select component and I found some missing features or/and possible > > bugs. > > > > 1. At site > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Select.html > > there is an example saying: > > > > <t:select t:id="color" > > model="literal:FF0000=Red,00FF00=Green,0000FF=Blue"/> will let me put > > on page component with colour names and their hex values as option > > values. > > > > This example isn't working and I have question: is it known bug or I > > just missed solution placed somewhere? > > > > 2. I couldn't find any way to force Tapestry to mark as "selected" > > option different than first one. > > > > Thank you in advance for your time and answers. > > > > Regards, > > Tomasz Dziurko > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]