Exemplo n.º 1
0
  @Override
  protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    // No longer applicable, breaks XHTML validation.
    tag.remove("disabled");
    tag.remove("name");
  }
Exemplo n.º 2
0
 @Override
 protected void onComponentTag(final ComponentTag tag) {
   super.onComponentTag(tag);
   // our component tag is not actually the input that is submitted
   if (tag.getAttributes().containsKey("name")) {
     tag.remove("name");
   }
 }
Exemplo n.º 3
0
  /**
   * Processes the component tag.
   *
   * @param tag Tag to modify
   * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
   */
  @Override
  protected void onComponentTag(final ComponentTag tag) {
    checkComponentTag(tag, "input");
    checkComponentTagAttribute(tag, "type", "checkbox");

    final String value = getValue();
    final IConverter<Boolean> converter = getConverter(Boolean.class);
    final Boolean checked = converter.convertToObject(value, getLocale());

    if (Boolean.TRUE.equals(checked)) {
      tag.put("checked", "checked");
    } else {
      // In case the attribute was added at design time
      tag.remove("checked");
    }

    // remove value attribute, because it overrides the browser's submitted value, eg a [input
    // type="checkbox" value=""] will always submit as false
    tag.remove("value");

    // Should a roundtrip be made (have onSelectionChanged called) when the
    // checkbox is clicked?
    if (wantOnSelectionChangedNotifications()) {
      CharSequence url = urlForListener(new PageParameters());

      Form<?> form = findParent(Form.class);
      if (form != null) {
        tag.put("onclick", form.getJsForInterfaceUrl(url));
      } else {
        // NOTE: do not encode the url as that would give invalid
        // JavaScript
        tag.put(
            "onclick",
            "window.location.href='"
                + url
                + (url.toString().indexOf('?') > -1 ? "&" : "?")
                + getInputName()
                + "=' + this.checked;");
      }
    }

    super.onComponentTag(tag);
  }
 protected void onComponentTag(final ComponentTag tag) {
   tag.remove("wicket:enclosure");
   super.onComponentTag(tag);
 }