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/25 12:25:25 UTC
T5: Select won't retain value when it rejects by the server
Hi,
I have a simple form as follows, if it can not pass onValidate, errors were
shown, and the value in the 'Name' field was retained, but the 'Gender' will
not retain the selected value, always goes back to blank unless I declare
gender field @Persist, why? Thanks.
<t:form t:id="regForm">
<input t:type="textfield" t:id="name" size="40"
t:validate="required,minlength=8" /><br />
<input t:type="select" name="gender" t:id="gender"
model="genderModel" t:validate="required" t:label="gender" t:value="gender"
/><br />
<input type="submit" name="Submit" id="Submit" value="Submit" /><br />
<t:errors />
</t:form>
--
View this message in context: http://www.nabble.com/T5%3A-Select-won%27t-retain-value-when-it-rejects-by-the-server-tf4689919.html#a13403938
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: Select won't retain value when it rejects by the server
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
hi angelo,
the ValidationTracker within the Form component stores field
values and error messages if a validation error occurs. this tracker
has the @Persist annotation applied and therefore saves
the field data with the error messages in the session. the data from
the tracker is then used to render the page
so if you dont have any validation errors no field will have a value :)
http://www.nabble.com/T5%3A-refreshing-page-when-there-is-an-error-tf4627982.html#a13233652
g,
kris
Angelo Chen <an...@yahoo.com.hk>
25.10.2007 14:37
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
users@tapestry.apache.org
Kopie
Thema
RE: T5: Select won't retain value when it rejects by the server
Hi Kristian,
Thanks for the reply, but why this one is retained:
<input t:type="textfield" t:id="name" size="40"
only this one not:
<input t:type="select" name="gender" t:id="gender"
model="genderModel" t:validate="required" t:label="gender"
t:value="gender"
kristian.marinkovic wrote:
>
> it is because of the way tapestry handles component requests!
>
>
--
View this message in context:
http://www.nabble.com/T5%3A-Select-won%27t-retain-value-when-it-rejects-by-the-server-tf4689919.html#a13405947
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: Select won't retain value when it rejects by the server
Posted by Angelo Chen <an...@yahoo.com.hk>.
Hi Kristian,
Thanks for the reply, but why this one is retained:
<input t:type="textfield" t:id="name" size="40"
only this one not:
<input t:type="select" name="gender" t:id="gender"
model="genderModel" t:validate="required" t:label="gender"
t:value="gender"
kristian.marinkovic wrote:
>
> it is because of the way tapestry handles component requests!
>
>
--
View this message in context: http://www.nabble.com/T5%3A-Select-won%27t-retain-value-when-it-rejects-by-the-server-tf4689919.html#a13405947
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: Select won't retain value when it rejects by the server
Posted by Kristian Marinkovic <kr...@porsche.co.at>.
it is because of the way tapestry handles component requests!
if a component fires an action (from a submit or link or...) tapestry
will first resolve the action methods and invoke them. after the action
methods have been invoked tapestry determines the page the
component is located in and generates a redirect to this page.
So a HTTPResonse goes back to the client and tells it to issue
a new request to the determined page and tapestry returns the
rendered page with the response.
because 2 requests are issued and field data is not persisted between
requests (they are discarded) your field will be blank. therefore you need
the persist annotation. if you use "session" your data will be stored in
the
session and stay there for subsequent requests. if you use "flash" your
data
will be stored ONLY for the period of the 2 request so tapestry can
render this
data.
please re-read the documentation (or watch one of the screencasts...
its explained and shown in the first i think) and search the mailinglist
for further details
g,
kris
Angelo Chen <an...@yahoo.com.hk>
25.10.2007 12:25
Bitte antworten an
"Tapestry users" <us...@tapestry.apache.org>
An
users@tapestry.apache.org
Kopie
Thema
T5: Select won't retain value when it rejects by the server
Hi,
I have a simple form as follows, if it can not pass onValidate, errors
were
shown, and the value in the 'Name' field was retained, but the 'Gender'
will
not retain the selected value, always goes back to blank unless I declare
gender field @Persist, why? Thanks.
<t:form t:id="regForm">
<input t:type="textfield" t:id="name" size="40"
t:validate="required,minlength=8" /><br />
<input t:type="select" name="gender" t:id="gender"
model="genderModel" t:validate="required" t:label="gender"
t:value="gender"
/><br />
<input type="submit" name="Submit" id="Submit"
value="Submit" /><br />
<t:errors />
</t:form>
--
View this message in context:
http://www.nabble.com/T5%3A-Select-won%27t-retain-value-when-it-rejects-by-the-server-tf4689919.html#a13403938
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