开发者

gwt/extjs - form not submitting

开发者 https://www.devze.com 2022-12-26 16:41 出处:网络
i have form tag received from designer. i need to submit the form from GWT given below. FormPanel form = null;

i have form tag received from designer.

i need to submit the form from GWT given below.

FormPanel form = null;
Button submit = null;
f开发者_如何学编程unction onModuleLoad(){
  form = FormPanel.wrap(DOM.getElementById("MyForm"));
  form.setEncoding(FormPanel.ENCODING_MULTIPART);

  submit = Button.wrap(DOM.getElementById("OK"));
  submit.addClickHandler(new ClickHandler() {
   public void onClick(ClickEvent event) {
    // button clicked confirmed
    form.submit();
   }
  });


  formSubmitHandler = form.addSubmitHandler(new SubmitHandler(){
   public void onSubmit(SubmitEvent event) {
                    }

  });
}

but form was not submitted.

designer wrote the following lines.

form action="./a.cgi" method="post" name="MyForm" id="MyForm"

input type="button" value="OK"

form


Are you sure that the form's submit button has an id of "OK"? It looks like the button's value is "OK" but I don't see anything with "OK" as an id.

It seems weird though, since DOM.getElementById("OK") will return null if no element is found, and I'm not sure what happens when wrap() gets passed a null.

Check if getElementById("OK") is returning null.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号