Does anyone know how to do this?
This is what I have so far inside my dialog definition:
The idea is to pop up a custom field (actually, several fields, but this is just a test) when you select something from the drop-down menu. I've set an alert inside my isChanged and switch statements, and those alerts go off -- the functions are firing and Firefox's error console gives me nothing. I'm stumped! But surely someone has tried this before? There are all sorts of good reasons to add options dynamically like this.
(And no, I can't just use the hide()/show() functions -- I need to be able to add the content as many times as the user wants, so it's not enough to just hide one extra element and then show it.)
UPDATE: I found a post of someone else trying something vaguely similar and tried to edit my code to match:
This is driving me SO CRAZY. Does anyone know how to dynamically add CHILDREN to an element? It seems like it should be so easy!
This is what I have so far inside my dialog definition:
id : 'answerType',
type : 'select',
label : 'Answer Type',
default : 'default',
items : [
['','default'],
['Radio Buttons','radio'],
['Check Boxes','checkbox'],
['Drop-Down Box','select'],
['Text Entry','text'],
['Scale','scale']
],
onChange : function() {
if (this.isChanged()) {
var quesTab = this.getDialog().definition.getContents( 'questions' );
switch(this.getValue()) {
case 'radio':
quesTab.add({
type : 'text',
label : 'My Custom Field',
id : 'customField'
});
break;
}
}
}The idea is to pop up a custom field (actually, several fields, but this is just a test) when you select something from the drop-down menu. I've set an alert inside my isChanged and switch statements, and those alerts go off -- the functions are firing and Firefox's error console gives me nothing. I'm stumped! But surely someone has tried this before? There are all sorts of good reasons to add options dynamically like this.
(And no, I can't just use the hide()/show() functions -- I need to be able to add the content as many times as the user wants, so it's not enough to just hide one extra element and then show it.)
UPDATE: I found a post of someone else trying something vaguely similar and tried to edit my code to match:
function setCampos( inputType ) {
switch ( inputType ){
case "radio":
CKEDITOR.dialog.getCurrent().definition.addContents({ id : 'question2', type : 'text', label : 'Question #1' });
// This doesn't work. It doesn't throw any errors, but it doesn't work. :(
break;
case "checkbox":
CKEDITOR.dialog.getCurrent().getContentElement("questions", "answerOption1").add("Modelo","modelo");
// This works, but only on elements with an ITEM definition.
break;
}
}This is driving me SO CRAZY. Does anyone know how to dynamically add CHILDREN to an element? It seems like it should be so easy!

@libek : code for above problem
@libek : did you find out the way to add children to element list dynamically ?
any ideas?
any ideas to add children of vbox dynamically?