You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Francois Armand <fa...@linagora.com> on 2007/09/13 17:35:29 UTC
Accessing fields of a form
Hello,
I have a form in a page, that is injected as a component in the java code.
To validate the form before submission, I want to do something like that :
8<------------------------------------------------------------
void onValidateFromForm() {
try {
validate data consistancy
} catch (Exception e) {
form.recordError(fieldWitchCauseTheError, "a text");
}
8<------------------------------------------------------------
But I don't understand how I can find "fieldWitchCauseTheError", I don't
see any method to access the list of field of the form (and I can't
inject fields because they are generated at runtime, or enclosed in
other components).
anybody know how can I access the fields of a form ?
Thanks,
--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org
FederID - http://www.federid.org/
Open Source identities management and federation
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Accessing fields of a form
Posted by Francois Armand <fa...@linagora.com>.
Howard Lewis Ship wrote:
> Performing cross-field validation can be a challenge. You might need to use
> some techniques such as storing an environmental object as a "score board"
> to identify the different fields related to the cross-field validation
Thank you for the answer, and I think that finally global messages will
be great ;)
--
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
InterLDAP - http://interldap.org
FederID - http://www.federid.org/
Open Source identities management and federation
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Accessing fields of a form
Posted by Howard Lewis Ship <hl...@gmail.com>.
Because Tapestry dynamically assembles the fields in the form, there isn't a
way to do this. Worse, because of Loops, Tapestry may use the same
component multiple times to handle different values from different objects.
That is why so much of the validation is tied to the components themselves,
threaded into the component's portion of the form submission process.
Performing cross-field validation can be a challenge. You might need to use
some techniques such as storing an environmental object as a "score board"
to identify the different fields related to the cross-field validation.
On 9/13/07, Francois Armand <fa...@linagora.com> wrote:
>
> Hello,
>
> I have a form in a page, that is injected as a component in the java code.
> To validate the form before submission, I want to do something like that :
> 8<------------------------------------------------------------
> void onValidateFromForm() {
> try {
> validate data consistancy
> } catch (Exception e) {
> form.recordError(fieldWitchCauseTheError, "a text");
> }
> 8<------------------------------------------------------------
>
> But I don't understand how I can find "fieldWitchCauseTheError", I don't
> see any method to access the list of field of the form (and I can't
> inject fields because they are generated at runtime, or enclosed in
> other components).
> anybody know how can I access the fields of a form ?
>
> Thanks,
>
> --
> Francois Armand
> Etudes & Développements J2EE
> Groupe Linagora - http://www.linagora.com
> Tél.: +33 (0)1 58 18 68 28
> -----------
> InterLDAP - http://interldap.org
> FederID - http://www.federid.org/
> Open Source identities management and federation
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Partner and Senior Architect at Feature50
Creator Apache Tapestry and Apache HiveMind