Re: T5: Recording custom validation errors onEvent(blur) on a form field

2008-04-30 Thread lebenski

Sorry for the shameless bump, but I'd really appreciate some help on this.


lebenski wrote:
> 
> Hi everyone,
> 
> Ok this is what i'm looking for:  A user types in their desired username,
> when the onBlur event happens on that input field (i.e. focus switches to
> the next field), IF the name is taken i'd like to utilise the standard
> tapestry validation error bubble, and display a message "User Name Taken".  
> 
> This is my solution, which doesn't display the message at all:
> 
> Page Class (simplified):
> @Component(id = "registerBasicForm")
>   private Form registerBasicForm;
>   
>   @Component
>   private Zone registerBasicZone;
> 
>   @Component(id = "registerbasic_userName")
>   @Mixins("t5components/OnEvent") 
>   private TextField userNameField;
> 
>   @OnEvent(component = "registerbasic_userName", value = "blur")
>   public Object onBlurEvent(String value) {   
>   
>   System.out.println("onBlurEvent() value: " + value);
> 
>   //Hardcoded username for testing purposes
> if(value.equals("iexist")) {
>   System.out.println("exists");
>   registerBasicForm.recordError(userNameField,"that name 
> exists");
>   
> System.out.println("registerBasicForm.getHasErrors():"+registerBasicForm.getHasErrors());
>   }
>   
>   return registerBasicZone;
>}
> 
>   public void onValidate() {
>   System.out.println("onValidate()");
>   
>   }
>   
>   public void onValidateForm() {
>   System.out.println("onValidateForm()");
>   }
> 
>   public void onValidateFromUserName(){
>   System.out.println("onValidateFromUserName()");
>   }
>   
>   public void onSubmit() {
>   System.out.println("onSubmit()");
>   }
>   
>   public Object onSuccess() {
>   System.out.println("onSuccess()");
>   return registerBasicZone;
>   }
>   
>   public Object onFailure() {
>   System.out.println("onFailure()");
>   return registerBasicZone;
>   }
>   
>   public void onSubmitFromRegisterBasicForm() {
>   System.out.println("onSubmitFromRegisterBasicForm()");
>   }
> 
> TML:
> 
>   
>zone="registerBasicZone">
>   User 
> Name:
>t:value="userName"
> event="blur"/>
>   
>for="registerbasic_password1">Password:
>t:value="password1"/>
>   
>   Repeat 
> Password:
>t:value="password2"/>
>   
>   Email:
>t:value="email"/>
>   
>   Subscribe?
>   
>   
>   Agree to   terms ?
>   
>   
>   
>   
>   
> 
> I'm expecting to see the error bubble onBlur(), but is this a correct
> assumption?  I can't find much documentation on recordError, do the errors
> get added to the form onValidate() maybe?  Also is it correct behaviour to
> return the zone from the onBlurEvent()? I'm quite new to tapestry forms
> and zones.
> 
> This is my logging output:
> 
> onBlurEvent() value: iexist
> exists
> registerBasicForm.getHasErrors(): true
> 
> Any help on this matter would be much appreciated.
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Recording-custom-validation-errors-onEvent%28blur%29-on-a-form-field-tp16964265p16979086.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



T5: Recording custom validation errors onEvent(blur) on a form field

2008-04-29 Thread lebenski

Hi everyone,

Ok this is what i'm looking for:  A user types in their desired username,
when the onBlur event happens on that input field (i.e. focus switches to
the next field), IF the name is taken i'd like to utilise the standard
tapestry validation error bubble, and display a message "User Name Taken".  

This is my solution, which doesn't display the message at all:

Page Class (simplified):
@Component(id = "registerBasicForm")
private Form registerBasicForm;

@Component
private Zone registerBasicZone;

@Component(id = "registerbasic_userName")
@Mixins("t5components/OnEvent") 
private TextField userNameField;

@OnEvent(component = "registerbasic_userName", value = "blur")
public Object onBlurEvent(String value) {   

System.out.println("onBlurEvent() value: " + value);

//Hardcoded username for testing purposes
if(value.equals("iexist")) {
System.out.println("exists");
registerBasicForm.recordError(userNameField,"that name 
exists");

System.out.println("registerBasicForm.getHasErrors():"+registerBasicForm.getHasErrors());
}

return registerBasicZone;
 }

public void onValidate() {
System.out.println("onValidate()");

}

public void onValidateForm() {
System.out.println("onValidateForm()");
}

public void onValidateFromUserName(){
System.out.println("onValidateFromUserName()");
}

public void onSubmit() {
System.out.println("onSubmit()");
}

public Object onSuccess() {
System.out.println("onSuccess()");
return registerBasicZone;
}

public Object onFailure() {
System.out.println("onFailure()");
return registerBasicZone;
}

public void onSubmitFromRegisterBasicForm() {
System.out.println("onSubmitFromRegisterBasicForm()");
}

TML:



User 
Name:


Password:


Repeat 
Password:


Email:


Subscribe?


Agree to   terms ?






I'm expecting to see the error bubble onBlur(), but is this a correct
assumption?  I can't find much documentation on recordError, do the errors
get added to the form onValidate() maybe?  Also is it correct behaviour to
return the zone from the onBlurEvent()? I'm quite new to tapestry forms and
zones.

This is my logging output:

onBlurEvent() value: iexist
exists
registerBasicForm.getHasErrors(): true

Any help on this matter would be much appreciated.
-- 
View this message in context: 
http://www.nabble.com/T5%3A-Recording-custom-validation-errors-onEvent%28blur%29-on-a-form-field-tp16964265p16964265.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]