You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by petros <pe...@cypoz.com> on 2007/06/11 11:50:35 UTC
Form Validation
I have a problem with the following code.
When the form is submitted my form displays a message advising if the email
is valid or not.
When the message is displayed I start another browser and I access the same
page. The message
is still displayed the first time the "second" user accesses this page. I
solved the problem by having the caller of UserDetails to call
setFeedbackMessage("") but I am not happy with this approach.
Is there a better approach for both feedbackMessage and formUserDetails ?
~~~~~~~~~~ UserDetails.html ~~~~~~~~~~~~~~~~~~~~~~~
<t:formUserDetails>
${feedbackMessage}
<input t:type="TextField" t:id="email" size="30"/>
</t:formUserDetails>
~~~~~~~~~~ UserDetails.java ~~~~~~~~~~~~~~~
@Persist("flash")
private String feedbackMessage = null;
@Component
private Form formUserDetails;
Object onSuccessFromFormUserDetails(){
if (!isValid(getEmail())){
formUserDetails.recordError("InvalidEmail");
}else{
feedbackMessage = "Valid Email";
}
}
~~~~~~~~~~~~~~~~ AppModule.java ~~~~~~~~~~~~~~~~~~~
public void contributeApplicationDefaults(MappedConfiguration<String,
String> configuration) {
configuration.add("tapestry.persistence-strategy", "flash");
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
View this message in context: http://www.nabble.com/Form-Validation-tf3900603.html#a11057776
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: Form Validation
Posted by petros <pe...@cypoz.com>.
Hi,
Please ignore the previous message.
I just realizes that the problem was with Firefox remembering the values.
Everything is working fine with IE.
Petros
petros wrote:
>
> I have a problem with the following code.
>
> When the form is submitted my form displays a message advising if the
> email is valid or not.
> When the message is displayed I start another browser and I access the
> same page. The message
> is still displayed the first time the "second" user accesses this page. I
> solved the problem by having the caller of UserDetails to call
> setFeedbackMessage("") but I am not happy with this approach.
>
> Is there a better approach for both feedbackMessage and formUserDetails ?
> ~~~~~~~~~~ UserDetails.html ~~~~~~~~~~~~~~~~~~~~~~~
> <t:formUserDetails>
> ${feedbackMessage}
> <input t:type="TextField" t:id="email" size="30"/>
> </t:formUserDetails>
>
> ~~~~~~~~~~ UserDetails.java ~~~~~~~~~~~~~~~
> @Persist("flash")
> private String feedbackMessage = null;
> @Component
> private Form formUserDetails;
>
> Object onSuccessFromFormUserDetails(){
> if (!isValid(getEmail())){
> formUserDetails.recordError("InvalidEmail");
> }else{
> feedbackMessage = "Valid Email";
> }
> }
>
> ~~~~~~~~~~~~~~~~ AppModule.java ~~~~~~~~~~~~~~~~~~~
> public void contributeApplicationDefaults(MappedConfiguration<String,
> String> configuration) {
> configuration.add("tapestry.persistence-strategy", "flash");
> }
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
--
View this message in context: http://www.nabble.com/Form-Validation-tf3900603.html#a11090591
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