Hi Bianca.

I'm working in T3, but T4 still uses a validation delegate,
so perhaps this might be helpful to you.

To make things easier, I extended ValidationDelegate to add:


    public boolean isComponentInError(String componentName)
    {
        List trackings = getAssociatedTrackings();
        if (trackings != null)
        {
            Iterator i = (Iterator)trackings.iterator();
            while (i.hasNext())
            {
                FieldTracking fieldTracking = (FieldTracking)i.next();
                if (componentName.equals(fieldTracking.getFieldName()))
                {
                    return fieldTracking.isInError();
                }
            }
        }

        return false;
    }

    public void clearComponentErrors(String[] componentNamesClear)
    {
        List namesList = Arrays.asList(componentNamesClear);
        List trackings = getAssociatedTrackings();
        if (trackings != null)
        {
            Iterator i = (Iterator)trackings.iterator();
            while (i.hasNext())
            {
                FieldTracking fieldTracking = (FieldTracking)i.next();
                if (namesList.contains(fieldTracking.getFieldName()))
                {
                    fieldTracking.setErrorRenderer(null);
                }
            }
        }
    }

and other such helper functions.

Then you can build dependancy validation in your form submit listener.

Cheers,
Nick.


Bode, Bianca wrote:
Hi all,

I was wondering if anyone has ever done the following, and if so, how :)

The situation is pretty complex, but basically it comes down to this:
I want to validate an Insert component, but only if another component, a
CheckBox, is checked...

Anyone?

Kind regards, Bianca.

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



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

Reply via email to