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.
精彩评论