We're not reproducing this one.
Here's my test case:
Code:
public void onModuleLoad() {
DataSource testDS = new DataSource();
testDS.setDataFormat(DSDataFormat.ISCSERVER);
testDS.setSparseUpdates(true);
testDS.setFields(
new DataSourceField("PUCD", FieldType.TEXT) {{
setPrimaryKey(true);
}},
new DataSourceField("PUVL", FieldType.TEXT),
new DataSourceField("FOO", FieldType.TEXT),
new DataSourceField("FOO2", FieldType.BOOLEAN)
);
ValuesManager vm = new ValuesManager();
vm.setDataSource(testDS);
final DynamicForm myForm = new DynamicForm();
myForm.setDataSource(testDS);
myForm.setValuesManager(vm);
myForm.setFields(new TextItem("PUCD"), new TextItem("PUVL"), new HiddenItem("FOO"), new HiddenItem("FOO2"), new SubmitItem("Submit"));
Map initMap = new HashMap();
initMap.put("PUVL", "testing");
initMap.put("FOO", "test2");
initMap.put("FOO2", false);
vm.editNewRecord(initMap);
Button setFoo2 = new Button ("click to set hidden field val");
setFoo2.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// set foo 2 programmatically
myForm.setValue("FOO2",true);
}
});
setFoo2.setLeft(300);
setFoo2.draw();
myForm.draw();
}
The code above has a hidden item "FOO2", which is initially set to false, but has a button to set to true.
If you hit submit without clicking the button to set the foo2 field value, the submitted request has a values object like this:
Code:
"data":{
"values":{
"FOO2":false,
"PUVL":"testing",
"FOO":"test2"
},
...
After hitting the button to modify FOO2, hitting submit gives me a request with the FOO2 value updated in the values block:
Code:
"data":{
"values":{
"FOO2":true,
"PUVL":"testing",
"FOO":"test2"
},
...
See if you can modify the above code to reproduce your problem and show us what's special about your form so we can figure this out!
Thanks
Isomorphic Software
Leave a comment: