I would like to set value of an form item, because it depends on preceding field.
I call form.getItem(name) method, which results is null.
I can get all the fields with getFields(), there is the named field, but I can’t get it from getField/getItem:(
It is a simple master detail form, created from a listgrid.
The master field generating is here:
protected FormItem createDefaultComboBox(String formFieldName, String formFieldTitle,
GwtRpcDataSource dataSource, int pickListWidth,
String displayField, String[] pickListFields, BaseDTO source) {
ComboBoxItem item = new ComboBoxItem(formFieldName, formFieldTitle);
item.setOptionDataSource(dataSource);
item.setPickListWidth(pickListWidth);
item.setValueField(FLD_ID);
item.setDisplayField(displayField);
ListGridField[] pickFields = new ListGridField[pickListFields.length];
for (int i=0;i<pickListFields.length;i++)
pickFields[i]=new ListGridField(pickListFields[i]);
item.setPickListFields(pickFields);
item.setRequired(true);
if (source != null)
item.setDefaultValue(source.getId().toString());
return item;
}
If I get all of the fields, there is 3 item in the result array. The 3rd item is: TextItem, jsObj is [TextItem ID:isc_TextItem_50 name:teacher]
(It is a Netbeans debugger)
I would like to get it from “teacher” name like form.getItem(“teacher”).
What do I mistake?
ps: my params are
Firefox 3.5,
SmartGwt from svn at yesterday
Gwt 1.6
Debian Linux unstable
public void beforeInsert(DynamicForm form) {
if (this.teacher != null) {
FormItem fld = this.getFormItem(form, FLD_TEACHER); // my custom, it works well
fld.setValue(this.teacher.getFullName());
fld = form.getItem(FLD_TEACHER); // original from DunamicForm
// it throws an exception
fld.setValue(this.teacher.getFullName());
}
}
no, you can’t debug obfuscated but you can generate without obfuscation against your application, not the smartclient .js files
maybe instead of debugging you should try to do a simple test case that does not work (create a dynamic form, add a formItem and use getForm).
If it works then try to add complexity until it stops working…
Oh and maybe use the latest svn version of smartgwt.jar if you don’t use it already…