I'm building dynamic forms in GWT, but I'm not sure how to dynamically retrieve the values upon submission.
I'm reading in question data from a DB and manually building elements that are added to a FormPanel
:
@UiField
FormPanel formPanel;
@Override
protected void onLoad()
{
service.getFields(AysncCallbak<Fields> callback)
{
public void onSuccess(Fields result)
{
for(Object yo : fields.stuff())
{
Element div = DOM.createDiv();
div.appendChild(DOM.createInputText());
formPanel.getElement().appendChild(div);
}
}
}
}
That's the gist in psuedocode, but I'm not sure how to retrieve the values after this point.
I want to serialize the form (get the HTML) and parse it with DOM, but GWT produces invalid XHTML (the input tags are not terminated, causing parse failure).
I could send the data to a Servlet, but there's a lot more stuff I need (other hidden input fields, etc.).
Most GWT form examples are incredibly trivial, or have explicit fields declared. Should I look at a 3rd party library? How do I get the dynamic values?