View Full Version : dialogwindow returning a Array
aEr_aEr
11-05-2002, 01:13 PM
i've got a dialogwindow witch returns an array.
In the dialog window i got a cancel button and an ok button.
but when i click the cancel button I don't get the array but a "undifined".
And I get the same problem when i close the window with the X on the window then the return value is null.
I tried to check if the return value is undifined or null, but then i get an error when the returnvalue is the array. This works fine when the returnvalue is a string.
I don't think it's a dificult problem to solve but i don't know how.
Has anyone got a solutions for this.
joh6nn
11-05-2002, 01:29 PM
can we see the code you're using, or barring that, can we at least know what it is you're trying to do?
aEr_aEr
11-05-2002, 01:38 PM
on the mainpage i got this code:
veranderd = window.showModalDialog("/_admin/GUI_Tools/wysiwyg_editor/font_style.asp",selectedRange,"dialogHeight: 300px; dialogWidth: 420px; scroll: 0; edge: Raised; center: Yes; help: No; resizable: No; status: No;");
if (veranderd[0])
execute('underline','',frame)
if (veranderd[1])
execute('bold','',frame)
if (veranderd[2])
execute('italic','',frame)
execute('fontStyle',veranderd[3],frame);
makeFontPixels(frame, veranderd[4]);
frame.document.execCommand('forecolor', false, veranderd[5]);
frame.document.execCommand('backcolor', false, veranderd[6]);
selectedRange.pasteHTML(veranderd[7]+selectedRange.htmlText+veranderd[8])
And on the dialogwindow i got 2 buttons
<input class=buttonInput type=button value="OK" onClick="window.returnValue =buildArray(); window.close();"><br>
<input class=buttonInput type=button value="Cancel" onClick="window.returnValue = null; window.close()">
when i click ok the array is being filled with the arguments, but when i click cancel the array "veranderd" that i get from the dialog window is not an array but a string with the content "undifined". And when i close the dialog window "veranderd" = null.
How can i check for these values.
If i do the following:
if ((veranderd!=null) || (veranderd!="undifined"))
Then i get an error when i click the ok button, because verander is an array and not a string
use:
if(!veranderd) //meaning cancel or X button click
else //somthing returned, do what ever you intend to
aEr_aEr
11-05-2002, 02:42 PM
thnx it's working
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.