Thanks a lot, it worked.:)

On Fri, Jan 22, 2010 at 4:24 PM, Sven Meier <[email protected]> wrote:

> target.addComponent(addLink) ??
>
> BTW you could override isVisible() and getOutputMarkupPlaceholderTag()
> instead of the attribute modifier.
>
> Sven
>
>
> Anna Simbirtsev wrote:
>
>> Hi,
>>
>> I am trying to use SimpleAttributeModifier to make an ADD MORE link
>> invisible once the maximum number of text fields that it adds have been
>> reached.
>> But I can not get it to render the link component.
>>
>> My code:
>>
>>  addLink = new AjaxSubmitLink("addRow", form) {
>>
>>            private static final long serialVersionUID =
>> 8103461308100688184L;
>>
>>            @Override
>>            public void onSubmit(AjaxRequestTarget target, Form<?> form) {
>>                 if (tech_count < max_tech_contacts) {
>>                     lv.getModelObject().add(new String());
>>                     if (target != null) {
>>                         target.addComponent(
>> techPanel);
>>                         tech_count++;
>>                     }
>>                     if (tech_count >= max_tech_contacts)
>>                         addLink.add(new SimpleAttributeModifier( "style",
>> "display:none"));
>>                 }
>>            }
>>  };
>>  addLink.setDefaultFormProcessing(false);
>>  form.add(addLink);
>>
>> I am guessing it adds style="display:none" to the addLink, but does not
>> render it again, so the link is still visible.
>>
>> Thanks,
>> Anna
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Anna Simbirtsev
(416) 729-7331

Reply via email to