Hi,

i use tapestry 4 beta 3.
I got these Class, page, html:


public class MyValidationDelegate extends ValidationDelegate { public void writerLabelPrefix(IFormComponent component,
           IMarkupWriter writer, IRequestCycle cycle) {
       if(isInError(component)){
           writer.begin("font");
           writer.attribute("color", "#FF0000");
       }
   }
public void writeLabelSuffix(IFormComponent component, IMarkupWriter writer, IRequestCycle cycle){
       if(isInError(component)){
           writer.end();
       }
   }
public void writeAttributes(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator){
       if(isInError()){
           writer.attribute("style", "BACKGROUND: yellow");
       }
   }
public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator){
       if(validator != null && validator.isRequired()){
           writer.printRaw(" ");
           writer.begin("font");
           writer.attribute("color", "black");
           writer.print("*");
           writer.end("font");
       }
}}

page:
....
<bean name="delegate" class="xx.yy.zz.MyValidationDelegate"/>
   <bean name="required" class="org.apache.tapestry.valid.StringValidator"
       lifecycle="render">
       <set name="required" value="true"/>
       <set name="minimumLength" value="3"/>
       <set name="requiredMessage" value="This field is required!"/>
       <set name="minimumLengthMessage" value="To Short!"/>
   </bean>
....

html:
....
<form jwcid="@Form" delegate="ognl:beans.delegate">
.... // here are the fields
</form>
...


This worked nice with tapestry 3.0.
After the update to Tapestry 4.0beta3 i got an problem with the method:

public void writeSuffix(IMarkupWriter writer, IRequestCycle cycle, IFormComponent component, IValidator validator){
   if(validator != null && validator.isRequired()){
           writer.printRaw("&nbsp;");
           writer.begin("font");
           writer.attribute("color", "black");
           writer.print("*");
           writer.end("font");
       }
}

The validator is always null?? does anyone see why?
Is it a bug in tapestry 4 beta 3?


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

Reply via email to