You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2006/08/10 21:02:42 UTC

Question about validation

Hello there! I'm having problems with validators...

First, my page is not validating required fields anymore (at least not
when I set a new ValidationDelegate):

public class CustomDelegate extends ValidationDelegate {

	public void writeAttributes(IMarkupWriter writer, IRequestCycle
cycle, IFormComponent component, IValidator validator) {
		if(isInError()){
			writer.attribute("style", "border:thin;border-color:#FF0000;");
		}
	}
}

<bean name="customDelegate" class="*.*.*.CustomDelegate"></bean>
	<component id="cadastroForm" type="Form">
  		<binding name="delegate" value="bean:customDelegate"></binding>
  	</component>

Also, I'm recording an error on my custom component using:

getForm().getDelegate().record(this,
getPage().getMessages().getMessage("error.invalid.time"));

And on my Page listener method I use:

alidationDelegate delegate = (ValidationDelegate)
getBeans().getBean("customDelegate");
		if(delegate.isInError()){
			return null;
		}

But delegate.isInError() is returning false. All my fields are
required, and even if I don't write anything on them, I still can't
get an error.

Any ideas?

Regards

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


Re: Question about validation

Posted by Simon Raveh <si...@sns-soft.com>.
You should use

delegate.getHasErrors()

Simon


Tim Sawyer wrote:
> On Thursday 10 August 2006 20:02, Vinicius Carvalho wrote:
>   
>> But delegate.isInError() is returning false. 
>>     
>
> I think that's the wrong method - try delegate.hasErrors() or something 
> similar.
>
> Tim.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   


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


Re: Question about validation

Posted by Tim Sawyer <li...@calidris.co.uk>.
On Thursday 10 August 2006 20:02, Vinicius Carvalho wrote:
> But delegate.isInError() is returning false. 

I think that's the wrong method - try delegate.hasErrors() or something 
similar.

Tim.

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