replace `getValues()` with `getForm().getFieldValues()`
tpo opened this issue · comments
Hello Lucassus,
first many thanks for your repostory, it has smoothed out my learning curve considerably and given me a friendly place to start from with the ExtJS Rails combo.
Now to the problem with your example code. Lines 54 to 56 in the Users JS controller read:
var values = form.getValues();
var user = Ext.create('AM.model.User', values);
This works when the values are simple types (as far as I understand) however not any more if a value is f.ex. of type date
. If it's a date
, instead of getting a date
type in values you get a string
(f.ex. "2013-03-13"). When you create a model from such a value, then Ext.create
will silently drop it, that means that the respective date field in the user
model will be set to null
.
In order to get values of the types of the fields of the form you need to use getFieldValues()
. For some reason that method is only available through another getForm()
so that would finally be:
var values = form.getForm().getFieldValues();
var user = Ext.create('AM.model.User', values);
That way the example code also works for fields that are of other type than string
or int
.
Thanks,
*t