Hi all,
I have created a window with different forms in it.
Here is one of the forms:
ksStatusForm = new dhtmlXForm("ppap_status");
ksStatusForm.loadStruct("ks_root/xml/ppap_status_form.xml");
ksStatusForm.attachEvent("onChange", timingChange);
Here’s how I appended these forms in a window:
win.appendObject("part_data");
win.appendObject("ppap_status");
win.appendObject("ppap_upload_form");
win.appendObject("ppap_timing_open");
win.appendObject("ppap_upload_button");
Now I want to replace the object “ppap_timing_open” by another object depending on the timingChange function.
function timingChange(idStatus, clicked) {
if (clicked=="n") I_dont_know_what_to_do_here;
}
Unfortunately I don’t know how to remove the appended object and how to append another object. (I’m a beginner )
Can somebody give me some tips?
Karl
Hi,
do you actually want to remove “ppap_timing_open” container ? In this case, you won’t be able to append this object again.
You may remove the container by the following approach:
var obj = document.getElementById(‘ppap_timing_open’);
obj.parentNode.removeChild(obj);
To move the object to document body (you need to use this approach if you are going to attach the object again):
document.body.appendChild(obj);
obj.style.display = “none”;
However, appendObject method adds the container to the end of the window. So, you will need to append the button after the object again
document.body.appendChild(obj);
obj.style.display = “none”;
var buttonObj = document.getElementById(‘ppap_upload_button’);
document.body.appendChild(buttonObj );
buttonObj.style.display = “none”;
win.appendObject(‘new_obj’);
win.appendObject(’‘ppap_upload_button’’);
The other solution is using views. If the number of changed containers is fixed, you may create views with them:
docs.dhtmlx.com/doku.php?id=dhtm … yout_views (this article refers to layout cell, however, the same methods are actual for window too).
Thanks for the lesson.
I think hiding the elements is a good solution but I will check the views option too.
I want to use in my form (which is in a popup window) a group of radio buttons which shall control showing and hiding form elements like input fields and calendars. So I think I should append all child elements and hide them. After that depending on user clicks one of the child elements shall appear.
If there is something I need to consider please let me know.
Karl