Hi, when adding custom fields to the Add Form page (and submitting the form), I'm getting this error:
this.cachedInitialData.fieldTypes[field.name] is undefined
Code:
->fieldTypeAddForm('entered_at','datetime')
->fieldTypeAddForm('initial_payment','numeric')
->fieldTypeAddForm('daily_cost','numeric')
->addFields(['car_type_id','plate','entered_at','initial_payment','daily_cost'])
->displayAs('entered_at','Name 1')
->displayAs('initial_payment','Name 2')
->displayAs('daily_cost','Name 3')
Javascript function with error:
getPostDataFromForm: function getPostDataFromForm($jqueryForm) {
var postData = {};
_.each($jqueryForm.serializeArray(), function eachFormFields(field) {
var dataType = this.cachedInitialData.fieldTypes[field.name].dataType;
if (dataType === 'relational_n_n' || dataType === 'native_relational_n_n') {
if (postData[field.name] === undefined) {
postData[field.name] = [field.value];
} else {
postData[field.name].push(field.value);
}
} else {
postData[field.name] = field.value;
}
}.bind(this));
return postData;
},
I have cleared the GroceryCRUD cache and the error persists.
Thank you