Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by guest on Nov 27, 2008 02:40
open dhtmlx forum
dhtmlx window - getElementById(id) is null after closing dhtmlx window

hello,

first my code:

a) my form:
<form name="insert_user" method="post">
    <label for="email"><? echo $_LANG["fm_email"]; ?></label> <span class="mandatory">*</span> <input type="text" name="email" value="" /><br />
    <p class="forminfo"><? echo $_LANG["fm_mandatory"]; ?></p>
    <input type="hidden" class="hidden" name="cmd" value="insert" />
    <input type="button" class="button" value="<? echo $_LANG["bt_create"]; ?>" onclick="checkForm('insert_user', 'email'))" /><br />                        
</form>

b) checkForm()
function is in a js-file include already in <head>-area:
checks, if field email is not null

part of checkform:

document.getElementById("msgbox").innerHTML = getContent("ajax/get_language.php", "word=er_mandatory");                
win.show();
eval("document."+fname+"."+arr[i]+".focus()");
return false;

c) messagebox:
<div id="msgbox"></div>

d) my dhtmlx window:    
<script>
var dhxWins = new dhtmlXWindows();        
var win = dhxWins.createWindow("msg", 0, 0, 200, 100);
win.hide();    
win.attachObject("msgbox");
win.denyMove();
win.center();
win.setText("Message");
win.button("minmax1").hide();
win.button("park").hide();
</script>

my problem now: if i click on button in formular, dhtmlx win shows up with a message. this is what i want. but, if i click another time on button in formular, a js-script error occurs "document.getElementById('msgbox') is null". it seems, that this div does not exist. thanks for your help.

greetings
guest
Answer posted by Support on Nov 27, 2008 03:17
Hello,

Right, it is happens because closing window affects on attached objects: they close too.
Try to use hiding window instead of closing.