florin.g wrote:

How do I pass the specific form submit button to the .htm page so that it
would know which listener to execute?

mypage.htm?param1=value&[?]


Form invokes Form#isFormSubmission[1] to check if the form has been submitted or not. For this check to succeed you'll need to pass the form-name parameter and the name of the Form for example:

  Form form = new Form("myform");

url:

  mypage.htm?form-name=myform

For the ActionListener to trigger the specific button's 'name' must be present as a request parameter as well:

  Form form = new Form("myform");
  Submit fancy = new Submit("fancy");

url:

  mypage.htm?form-name=myform&fancy=fancy



And if the POST is default, can I change a page form's method to GET
dynamically?


The form method can be dynamically changed on the server side:

public class MyPage extends Page {
  public void onInit() {
    Context context = getContext();
    Form form = new Form("myform");

    if(context.isGet()) {
      form.setMethod("get");
    }

  }
}


Hope this helps.

kind regards

bob

[1]: http://incubator.apache.org/click/docs/click-api/net/sf/click/control/Form.html#isFormSubmission()



Reply via email to