Hi!

I need to accomplish the following:
1. receive ajax onchange event from a formcomponent
2. receive "defaultformprocesing=false" style submit
3. repaint an area; I this is why I need the form to be really
submitted (=rawinput but not validated).

I have built a custom component FormSubmittingDropDownChoice.

The problem is that even if I press another submit component (button,
for example), the form allways assumes the formSubmitting component to
be FormSubmittingDropDownChoice. Why? Because the findSubmittingButton
is so simple that if FormSubmittingDropDownChoice has a value, it is
the submitting component.

Is there a workaround or fix? How could I achieve similar
functionality in a working manner? This works well if I click the
FormSubmittingDropDownChoice, otherwise it does not :(

package com.tustor.wicket.common.reusables.formcomponents;

public class FormSubmittingDropDownChoice<T> extends DropDownChoice<T>
implements IFormSubmittingComponent {

  public FormSubmittingDropDownChoice(String id, various constructor options) {
    super(id, choices, renderer);
  }
  /**
   * @see 
org.apache.wicket.markup.html.form.IFormSubmittingComponent#getDefaultFormProcessing()
   */
  public boolean getDefaultFormProcessing() {
    return false;
  }

  /**
   * @see org.apache.wicket.markup.html.form.IFormSubmittingComponent#onSubmit()
   */
  public void onSubmit() {
    // override
  }

  /**
   * wicket-ajax:
   *
   * if (submitButton != null) {
   *   s += Wicket.Form.encode(submitButton) + "=1";
   * }
   *
   * @see org.apache.wicket.markup.html.form.FormComponent#getInputAsArray()
   */
  @Override
  public String[] getInputAsArray() {
    return MarkupUtils.filterSubmitIndicator(super.getInputAsArray());
  }

  /**
   * @see 
org.apache.wicket.markup.html.form.AbstractSingleSelectChoice#getModelValue()
   */
  @Override
  public String getModelValue() {
    String value = super.getModelValue();
    if ("1".equals(value)) {
      throw new IllegalStateException("1 not supported because of
javaScript wicket-ajax:submitForm: function(form, submitButton)");
    }
    return value;
  }
}

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

Reply via email to