editor.clear()->Cannot read property 'destroy' of undefined
editor.clear()->Cannot read property 'destroy' of undefined
fattest
Posts: 3Questions: 1Answers: 0
Hi!
what am I doing wrong!
gives an error message?
editor.clear(["org_name","short_name","inn","kpp","business_address","post_address","bank_account","bik_bank",
"function","surname","name","patronymic","phone","email","ogrnip","serial_pass","number_pass","issued_date_pass"]);->Cannot read property 'destroy' of undefined
$('input', editor.node( 'org_type' ) ).on( 'change', function () {
editor.clear(["org_name","short_name","inn","kpp","business_address","post_address","bank_account","bik_bank",
"function","surname","name","patronymic","phone","email","ogrnip","serial_pass","number_pass","issued_date_pass"]);
switch (editor.get( 'org_type' )) {
case 1:
editor.add([
{
"label": "Наименование организации",
"name": "org_name"
},
{
"label": "Краткое наименование",
"name": "short_name"
},
{
"label": "ИНН",
"name": "inn"
},
{
"label": "КПП",
"name": "kpp"
},
{
"label": "Юридический адрес",
"name": "business_address"
},
{
"label": "фактический адрес",
"name": "post_address"
},
{
"label": "расчетный счет",
"name": "bank_account"
},
{
"label": "БИК",
"name": "bik_bank"
},
{
"label": "Должность руководителя",
"name": "function"
},
{
"label": "Фамилия",
"name": "surname"
},
{
"label": "Имя",
"name": "name"
},
{
"label": "Отчество",
"name": "patronymic"
},
{
"label": "Телефон",
"name": "phone"
},
{
"label": "E-mail",
"name": "email"
}
]);
break;
case 2:
editor.add([
{
"label": "Наименование ИП",
"name": "org_name"
},
{
"label": "Краткое наименование",
"name": "short_name"
},
{
"label": "ИНН",
"name": "inn"
},
{
"label": "ОГРНИП",
"name": "ogrnip"
},
{
"label": "Юридический адрес",
"name": "business_address"
},
{
"label": "фактический адрес",
"name": "post_address"
},
{
"label": "расчетный счет",
"name": "bank_account"
},
{
"label": "БИК",
"name": "bik_bank"
},
{
"label": "Должность руководителя",
"name": "function"
},
{
"label": "Фамилия",
"name": "surname"
},
{
"label": "Имя",
"name": "name"
},
{
"label": "Отчество",
"name": "patronymic"
},
{
"label": "Телефон",
"name": "phone"
},
{
"label": "E-mail",
"name": "email"
}
]);
break;
case 3:
editor.add([
{
"label": "Краааткое наименование",
"name": "short_name"
},
{
"label": "Фамилия",
"name": "surname"
},
{
"label": "Имя",
"name": "name"
},
{
"label": "Отчество",
"name": "patronymic"
},
{
"label": "серия",
"name": "serial_pass"
},
{
"label": "Номер",
"name": "number_pass"
},
{
"label": "Кем выдан",
"name": "issued_pass"
},
{
"label": "Дата выдачи",
"name": "issued_date_pass"
},
{
"label": "Отчество",
"name": "patronymic"
},
{
"label": "Адрес регистрации",
"name": "business_address"
},
{
"label": "Почтовый адрес",
"name": "post_address"
},
{
"label": "ИНН",
"name": "inn"
},
{
"label": "Телефон",
"name": "phone"
},
{
"label": "E-mail",
"name": "email"
}
]);
break;
default:
alert('Я таких значений не знаю')
}
} );
} );
This discussion has been closed.
Answers
What error message?
...."issued_date_pass"]);->Cannot read property 'destroy' of undefined
Oh sorry - it was hidden in the scrolling part!
The error you are seeing will occur if you attempt to access a field which isn't defined (in this case destroying a field that doesn't exist).
If you simply want to remove all fields, then I would suggest using
order()
to get the current fields -editor.clear( editor.order() )
would remove all existing fields for example.Allan
Thanks, I understand.
I did so:
But there is another problem.
After the addition of new fields do not load data
p. s. sorry for my English
They won't actually get the data from the table. You would need to use
val()
to set values for newly created fields.Perhaps it would be easier to simply include all of the fields in the form, and then use
show()
andhide()
to show and hide the fields as you require, rather than adding and removing them.Allan