/** * Find all checkboxes in the containing form with the same input name as the {@link CheckGroup} * . */ @Override protected CharSequence getFindCheckboxesFunction() { CheckGroup<?> group = getGroup(); if (group == null) { throw new WicketRuntimeException( "CheckGroupSelector component [" + getPath() + "] cannot find its parent CheckGroup. All CheckGroupSelector components must be a child of or below in the hierarchy of a CheckGroup component."); } // we search the complete form because the CheckGroup might not output its markup tag or be // located on a <wicket:container> return String.format("Wicket.CheckboxSelector.findCheckboxesFunction('%s','%s')", group.getForm().getMarkupId(), group.getInputName()); } }
/** * Find all checkboxes in the containing form with the same input name as the {@link CheckGroup} * . */ @Override protected CharSequence getFindCheckboxesFunction() { CheckGroup<?> group = getGroup(); if (group == null) { throw new WicketRuntimeException( "CheckGroupSelector component [" + getPath() + "] cannot find its parent CheckGroup. All CheckGroupSelector components must be a child of or below in the hierarchy of a CheckGroup component."); } // we search the complete form because the CheckGroup might not output its markup tag or be // located on a <wicket:container> return String.format("Wicket.CheckboxSelector.findCheckboxesFunction('%s','%s')", group.getForm().getMarkupId(), group.getInputName()); } }
protected void onComponentTag(ComponentTag tag) { // must be attached to <input type="checkbox" .../> tag checkComponentTag(tag, "input"); checkComponentTagAttribute(tag, "type", "checkbox"); CheckGroup group = (CheckGroup)findParent(CheckGroup.class); if (group == null) { throw new WicketRuntimeException( "CheckGroupSelector component [" + getPath() + "] cannot find its parent CheckGroup. All CheckGroupSelector components must be a child of or below in the hierarchy of a CheckGroup component."); } tag.put( "onclick", "var cb=this.form['" + group.getInputName() + "']; if (cb!=null) { if (!isNaN(cb.length)) { for(var i=0;i<cb.length;i++) { cb[i].checked=this.checked; } } else { cb.checked=this.checked; } }"); super.onComponentTag(tag); }
tag.put("name", group.getInputName()); tag.put("value", uuid);
tag.put("name", group.getInputName()); tag.put("value", uuid);
tag.put("name", group.getInputName()); tag.put("value", uuid); (url.toString().indexOf('?') > -1 ? "&" : "?") + group.getInputName() + "=' + this.value;");
tag.put("name", group.getInputName()); tag.put("value", uuid); (url.toString().indexOf('?') > -1 ? "&" : "?") + group.getInputName() + "=' + this.value;");
"onclick", "var cb=this.form['" + group.getInputName() + "']; if (cb!=null) { if (!isNaN(cb.length)) { for(var i=0;i<cb.length;i++) { if (cb[i].disabled) continue; if (cb[i].checked != this.checked) {cb[i].click();} } } else { if (!cb.disabled&&cb.checked != this.checked) {cb.click();} } }");