PDA

View Full Version : FormBinding wthout Store



kotrao
5 Jan 2011, 10:53 AM
Hi,

I am binding my BeanModel to a form.

BeanModelFactory factory = BeanModelLookup.get().getFactory(VitalSigns.class);
VitalSignsBean vs = factory.createModel(vitalSigns);
formBindings.autoBind();
formBindings.bind( vs);
formBindings.setUpdateOriginalValue(true);

On the click event of the select button, I am trying to read the values from my model as follows:
BeanModel bean = (BeanModel)formBindings.getModel();
VitalSigns v = bean.getBean();
Window.alert("Systolic: " +v.getBpSystolic());

I keep seeing the old values in the model. I don't see the updated values in the form.

All the examples I have seen are using some kind of Store object. I am wondering if the bidirectional binding works between BeanModel and Form. If it is supposed to work, I would appreciate if someone can point out the mistake I am making in the code.

Thanks,
Rao

sven
5 Jan 2011, 12:39 PM
store should not be related to this. Please post a fully working testcase that implements EntyPoint and shows your problem

kotrao
5 Jan 2011, 3:13 PM
I realized my problem as started putting together test case. Some of the fields are numeric fields. So it was failing to convert String to integer as it was trying to update the model. Somehow I couldn't see those errors while working in my as there were some other stack traces. I added a Converter to FieldBinding to convert field value to Integer. Now it is working.

Sorry, it was my bad.