tags:

views:

193

answers:

1

i have form tag received from designer.

i need to submit the form from GWT given below.

FormPanel form = null;
Button submit = null;
function 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
A: 

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.

Jason Hall