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: > > <t:zone t:id="registerBasicZone" visible="true"> > <t:form t:id="registerBasicForm" t:class="gForm" > zone="registerBasicZone"> > <t:label for="registerbasic_userName">User > Name:</t:label> > <t:textfield t:id="registerbasic_userName" > t:value="userName" > event="blur"/> > <br/> > <t:label > for="registerbasic_password1">Password:</t:label> > <t:passwordfield t:id="registerbasic_password1" > t:value="password1"/> > <br/> > <t:label for="registerbasic_password2">Repeat > Password:</t:label> > <t:passwordfield t:id="registerbasic_password2" > t:value="password2"/> > <br/> > <t:label for="registerbasic_email">Email:</t:label> > <t:textfield t:id="registerbasic_email" > t:value="email"/> > <br/> > <t:label for="newsletter">Subscribe?</t:label> > <t:checkbox t:id="newsletter" t:value="newsletter"/> > <br/> > <t:label for="terms">Agree to terms ?</t:label> > <t:checkbox t:id="terms" t:value="terms"/> > <br/> > <input t:id="submit" t:type="Submit" t:value="submit" /> > </t:form> > </t:zone> > > 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]