You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicket_new_user <mu...@gmail.com> on 2012/11/07 12:02:37 UTC

Checkbox Onclick event usage

Hi,
I need help on how to incorporate the Javascript function for onclick event
in Checkbox

Scenario as follows
==============
I have 2 checkboxes and this are taken as a Checkbox group


private CheckGroup<ModelType> addType(final MarkupContainer parent, final
String id,
            final IModel<ModelCriteriaModel> model)
    {
        final CheckGroup<ModelType> result = new CheckGroup<ReportType>(id,
new PropertyModel<Set&lt;ModelType>>(model,
                "model.types"));
        result.add(new ListView<ModelType>("modelsTypes",
Arrays.asList(ModelType.values())) {
            private static final long serialVersionUID = 1L;

            /** {@inheritDoc} */
            @Override
            protected void populateItem(final ListItem<ModelType> item)
            {
                item.add(new Check<ModelType>("type", item.getModel()));
                item.add(new Label("name",
getLocalizer().getString(String.format("modelType.%s", item
                        .getModelObject().getIdentifier()), getPage())));
            }
        });
        parent.add(result);
        return result;
    }

On clicking of one checkbox, one field needs to be hidden from the form
and unselecting, needs to be displayed back

can you please help me out



--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Checkbox-Onclick-event-usage-tp4653676.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Checkbox Onclick event usage

Posted by Sven Meier <sv...@meiers.net>.
Attach an AjaxFormChoiceComponentUpdatingBehavior to the group.

Sven

On 11/07/2012 12:02 PM, wicket_new_user wrote:
> Hi,
> I need help on how to incorporate the Javascript function for onclick event
> in Checkbox
>
> Scenario as follows
> ==============
> I have 2 checkboxes and this are taken as a Checkbox group
>
>
> private CheckGroup<ModelType> addType(final MarkupContainer parent, final
> String id,
>              final IModel<ModelCriteriaModel> model)
>      {
>          final CheckGroup<ModelType> result = new CheckGroup<ReportType>(id,
> new PropertyModel<Set&lt;ModelType>>(model,
>                  "model.types"));
>          result.add(new ListView<ModelType>("modelsTypes",
> Arrays.asList(ModelType.values())) {
>              private static final long serialVersionUID = 1L;
>
>              /** {@inheritDoc} */
>              @Override
>              protected void populateItem(final ListItem<ModelType> item)
>              {
>                  item.add(new Check<ModelType>("type", item.getModel()));
>                  item.add(new Label("name",
> getLocalizer().getString(String.format("modelType.%s", item
>                          .getModelObject().getIdentifier()), getPage())));
>              }
>          });
>          parent.add(result);
>          return result;
>      }
>
> On clicking of one checkbox, one field needs to be hidden from the form
> and unselecting, needs to be displayed back
>
> can you please help me out
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Checkbox-Onclick-event-usage-tp4653676.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org