Yes... you are right... that was a typing error... but only in the email ;) The
original code has a '{' before the validator.
But my problem still exist...
Any idea?
Regards, Alf
-----Ursprüngliche Nachricht-----
Von: Now I find myself in question <[email protected]>
Gesendet: 31.03.2010 09:44:03
An: MyFaces Discussion <[email protected]>
Betreff: Re: [Tobago] Using validator in custom tag
>yes it should be like..
>
>inExtensionTag.setValidator("#*{*validator.validate*}*");
>
>Thanks,
>Vinod
>
>On Wed, Mar 31, 2010 at 12:55 PM, Helmut Swaczinna
><[email protected]>wrote:
>
>> Hi,
>>
>> there's no '{' in "#validator.validate}");
>>
>> Regards
>>
>> Helmut
>>
>>
>> Am 30.03.2010 18:53, schrieb Alf Felis:
>>
>> Hi all,
>>>
>>> I try to use a validator dependent on a property within a custom tag
>>> class.
>>>
>>> My class extends TagSupport and overwrites the doStartTag() method.
>>> In this method I add a validator depending on a property (see below).
>>>
>>> First the property is "false" and no validator will be added to the
>>> inExtensionTag. Now (next access to the page) the property will change to
>>> "true" and the output "Setting validator!" shows me, that the validator has
>>> been set. But the validator will never be called!
>>>
>>> If I always add the validator (not depending on the property), everything
>>> works fine. The validator will be called on submit.
>>>
>>> What is wrong with my approach?
>>> Is there another possibility to do what I want?
>>>
>>> Example:
>>>
>>> @Override
>>> public int doStartTag() throws JspException {
>>> InExtensionTag inExtensionTag = new InExtensionTag();
>>> inExtensionTag.setPageContext(pageContext);
>>> inExtensionTag.setParent(getParent());
>>> inExtensionTag.setId(id);
>>> inExtensionTag.setLabel(label);
>>> inExtensionTag.setValue(value);
>>> if (isValidationEnabled()) {
>>> System.out.println("Setting validator!");
>>> inExtensionTag.setValidator("#validator.validate}");
>>> }
>>> inExtensionTag.doStartTag();
>>> inExtensionTag.doEndTag();
>>> return super.doStartTag();
>>> }
>>>
>>>
>>> Best regards,
>>>
>>> Alf
>>>
>>>
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01