You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jbo <jb...@infogenia.pl> on 2004/11/15 09:37:45 UTC

Simple question from tapestry novice

Hi !!

I have textbox and  button on a page.

I need the button to be disabled when in text field we have less then 3
characters entered.

Normally I would do this with JavaScript.

How to proceed with such simple case in  Tapestry application?

Java Script or the power of TapestryMagic?

Best Regards

 

-jbo

 

 

 


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-13
 

Re: Best Practises, Validation, I18N

Posted by Manri Offermann <ta...@eastbeam.co.jp>.
Thanks!

That's exactly what I was looking for.



Manri


----- Original Message ----- 
From: "Markus Wiederkehr" <ma...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, November 15, 2004 7:33 PM
Subject: Re: Best Practises, Validation, I18N


> Q1 and Q2: Do the validation in your listener method, after
> delegate.getHasErrors(). Here is an example:
>
>  public void addUser(IRequestCycle cycle)
>  {
>    IValidationDelegate delegate = (IValidationDelegate) 
> getBeans().getBean(
>        "delegate");
>    if (delegate.getHasErrors())
>      return;
>
>    String password1 = getPassword1();
>    String password2 = getPassword2();
>    if (!password1.equals(password2))
>    {
>      IFormComponent pwd1 = (IFormComponent) 
> getComponent("inputPassword1");
>      delegate.setFormComponent(pwd1);
>      delegate.recordFieldInputValue("");
>      delegate.record(getMessage("passwordMismatch"),
>          ValidationConstraint.CONSISTENCY);
>      setPassword2(null);
>      return;
>    }
>
>  ...
>  }
>
> Q3: Look here: http://makeashorterlink.com/?I36A568C9
>
> hth,
>
> Markus
>
>
> On Mon, 15 Nov 2004 19:15:54 +0900, Manri Offermann
> <ta...@eastbeam.co.jp> wrote:
>> Hi all,
>>
>> sorry I am still new here and I have multiple questions ...
>>
>> Q1
>> Is there any way of validating values of two different form components 
>> with
>> the ValidationDelegate and a custom Validator? For example:
>>
>> - Password & Password Confirmation (whether the values of both fields are
>> identical)
>> - Email & Email Confirmation (whether the values of both fields are
>> identical)
>>
>> If not, what is the best practise to do validations like these?
>> Currently I check both strings and then record a new ValidatorException 
>> to
>> the Delegate.
>>
>> Q2
>> How about other errors which are raised from somewhere else, like a 
>> "Login
>> failed" error? Is it bad practise to record them with the 
>> ValidationDelegate
>> since the ValidationDelegate should only record Form Validation errors?
>>
>> Q3
>> Where is the best place to store String properties like "Application 
>> Name"?
>> In a multilingual environment the application name is not always 
>> identical
>> (different alphabets, names -> can not store in application 
>> specification)
>> and String properties like these are needed by several pages and
>> components - so a per component or page solution is not very comfortable. 
>> I
>> am currently loading a ResourceBundle in the Global object - how is 
>> everyone
>> else solving this matter?
>>
>> I have just started with Tapestry+Spring+Hibernate. Great Tools! - Except
>> for the ugly URLs ... But I have followed the instruction in the Wiki for
>> Friendlier URLs and it works.
>>
>> Manri Offermann
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
> 



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


Re: Best Practises, Validation, I18N

Posted by Markus Wiederkehr <ma...@gmail.com>.
Q1 and Q2: Do the validation in your listener method, after
delegate.getHasErrors(). Here is an example:

  public void addUser(IRequestCycle cycle)
  {
    IValidationDelegate delegate = (IValidationDelegate) getBeans().getBean(
        "delegate");
    if (delegate.getHasErrors())
      return;

    String password1 = getPassword1();
    String password2 = getPassword2();
    if (!password1.equals(password2))
    {
      IFormComponent pwd1 = (IFormComponent) getComponent("inputPassword1");
      delegate.setFormComponent(pwd1);
      delegate.recordFieldInputValue("");
      delegate.record(getMessage("passwordMismatch"),
          ValidationConstraint.CONSISTENCY);
      setPassword2(null);
      return;
    }

  ...
  }

Q3: Look here: http://makeashorterlink.com/?I36A568C9

hth,

Markus


On Mon, 15 Nov 2004 19:15:54 +0900, Manri Offermann
<ta...@eastbeam.co.jp> wrote:
> Hi all,
> 
> sorry I am still new here and I have multiple questions ...
> 
> Q1
> Is there any way of validating values of two different form components with
> the ValidationDelegate and a custom Validator? For example:
> 
> - Password & Password Confirmation (whether the values of both fields are
> identical)
> - Email & Email Confirmation (whether the values of both fields are
> identical)
> 
> If not, what is the best practise to do validations like these?
> Currently I check both strings and then record a new ValidatorException to
> the Delegate.
> 
> Q2
> How about other errors which are raised from somewhere else, like a "Login
> failed" error? Is it bad practise to record them with the ValidationDelegate
> since the ValidationDelegate should only record Form Validation errors?
> 
> Q3
> Where is the best place to store String properties like "Application Name"?
> In a multilingual environment the application name is not always identical
> (different alphabets, names -> can not store in application specification)
> and String properties like these are needed by several pages and
> components - so a per component or page solution is not very comfortable. I
> am currently loading a ResourceBundle in the Global object - how is everyone
> else solving this matter?
> 
> I have just started with Tapestry+Spring+Hibernate. Great Tools! - Except
> for the ugly URLs ... But I have followed the instruction in the Wiki for
> Friendlier URLs and it works.
> 
> Manri Offermann
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

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


Best Practises, Validation, I18N

Posted by Manri Offermann <ta...@eastbeam.co.jp>.
Hi all,

sorry I am still new here and I have multiple questions ...


Q1
Is there any way of validating values of two different form components with 
the ValidationDelegate and a custom Validator? For example:

- Password & Password Confirmation (whether the values of both fields are 
identical)
- Email & Email Confirmation (whether the values of both fields are 
identical)

If not, what is the best practise to do validations like these?
Currently I check both strings and then record a new ValidatorException to 
the Delegate.


Q2
How about other errors which are raised from somewhere else, like a "Login 
failed" error? Is it bad practise to record them with the ValidationDelegate 
since the ValidationDelegate should only record Form Validation errors?

Q3
Where is the best place to store String properties like "Application Name"? 
In a multilingual environment the application name is not always identical 
(different alphabets, names -> can not store in application specification) 
and String properties like these are needed by several pages and 
components - so a per component or page solution is not very comfortable. I 
am currently loading a ResourceBundle in the Global object - how is everyone 
else solving this matter?


I have just started with Tapestry+Spring+Hibernate. Great Tools! - Except 
for the ugly URLs ... But I have followed the instruction in the Wiki for 
Friendlier URLs and it works.


Manri Offermann 



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


Re: Simple question from tapestry novice

Posted by John Meredith <ps...@bigpond.com>.
Hi,

The behaviour you describe is purely on the client/browser side. You'll 
still need to do this with Javascript.

   - John

On 15/11/2004, at 6:37 PM, jbo wrote:

> Hi !!
>
> I have textbox and  button on a page.
>
> I need the button to be disabled when in text field we have less then 3
> characters entered.
>
> Normally I would do this with JavaScript.
>
> How to proceed with such simple case in  Tapestry application?
>
> Java Script or the power of TapestryMagic?
>
> Best Regards
>
>
>
> -jbo
>
>
>
>
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.796 / Virus Database: 540 - Release Date: 2004-11-13
>
>

--
John Meredith <jm...@psynix.com>


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