Hi gang,
Am I correct in thinking that having a parent component isEnabled() to
false does not prevent the children validation (1.3.0-rc1 for that matter) ?
I see in Form
public Object formComponent(IFormVisitorParticipant component)
{
if (component instanceof FormComponent)
{
FormComponent formComponent = (FormComponent)component;
if (formComponent.isVisibleInHierarchy() &&
formComponent.isValid() &&
formComponent.isEnabled() &&
formComponent.isEnableAllowed())
{
validate(formComponent);
}
}
I would have thought at first glance that it did not make any sense to
traverse the components for validation if the parent is disabled.
side note: (Also for personal knowledge, is there any reason why the
check for visibility is actually backward for traversal ? validation is
occurring by traversing the tree top down, so I would have think in
theory that stopping the traversal would be enough to avoid having each
component doing a bottom top check in isVisibleInHierarchy(). I suppose
there is a reason for that (haven't checked yet the formvalidators logic
to see how components are treated, if they are iterated over I guess
that can explain while they all need to traverse the parent hierarchy)
I see in the same code that to avoid traversing the children I can make
use of the method processChildren() to stop the traversal.. that's what
I did right now, but I'm not sure if this is really the intent or if
it's just a hack.
(basically I have a component (containing other components) which is
enabled based on a checkbox input (which enable-show/disable-hide the
children components through javascript), so I end up testing the water
with something like:
MyParentComponent my = new MyParentComponent("test") {
public boolean isEnabled() {
return radio1.getMarkupId().equals(radiogroup.getInput());
}
public boolean processChildren() {
return isEnabled();
}
};
That seems a bit 'hacky' and I wonder if the recommended way is not to
entirely make it wicketable with ajaxable component all around that
always do server round-trip ?
thanks
-- stephane
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]