how to best determine original type option?
how to best determine original type option?
I have a special button which shows a create form, but with all fields hidden. Once the form is dismissed, I need to set the correct show/hide for each field, based on the original field type (checking type === "hidden"). I have the following code, as I was not able to see any api which would help, but maybe I missed something.
Is there a better way?
This code is currently executed when the form is displayed (after hiding all the fields and displaying special purpose "create" text).
// show appropriate fields again after the form closes, based on original option
config.editor.one('submitComplete preClose', function(e) {
config.editor.show();
var fields = config.editor.order();
for (var i=0; i<fields.length; i++) {
var field = fields[i];
// warning: using editor internals, not from API
if (config.editor.s.fields[field].s.opts.type === "hidden") {
config.editor.field(field).hide();
}
}
})
This question has an accepted answers - jump to answer
Answers
Yep, that looks good,
Colin