THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
To validate a form component before after a page loads load add the following to the form componentpage
Code Block |
---|
...
protected void onBeforeRender()
{
super.onBeforeRender();
visitChildren(FormComponent.class, new IVisitor()
{
public Object component(Component component)
{
FormComponent formComponent = (FormComponent) component;
if (formComponent.isRequired())
{
// This can be any validator
formComponent.error((IValidationError)new ValidationError().addMessageKey("Required"));
}
return IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
}
});
}
...
|