Note that there are some explanatory texts on larger screens.

plurals
  1. POPass variable values from child XUL window to parent XUL window using JavaScript
    primarykey
    data
    text
    <p>I have a function to get the values of the selected check-box from the xul file(Lets say tree.xul). In another XUL file has the text-box where I want to pass the values(label values) of the selected check-box(Lets say textbox.xul).</p> <p>Originally I'm opening my "tree.xul" file from "textbox.xul" file. When I select the check box values and click on the button to pass the values to an another xul file("textbox.xul").</p> <p>I have a text-box in "textbox.xul" file, I want to pass the values of the check-box to this text-box.</p> <pre><code> &lt;textbox id="ali" value=""/&gt; &lt;button label="Contacts" onclick="DisplayContacts();"/&gt; </code></pre> <p>In my script I'm trying like this but it's not working and also I have included this small piece of code function </p> <blockquote> <p>window.close();</p> </blockquote> <p>to close the window("tree.xul") after passing the values.</p> <p>Do i have to use an array to store all the values of the variable?</p> <p>I'm trying using the explanation from Mozilla dialog but it's not working.</p> <pre><code> function get() { // check the alignment on a number of cells in a table. var table = document.getElementById("box"); var cells = table.getElementsByTagName("checkbox"); for (var i = 0; i &lt; cells.length; i++) { var cell = cells[i]; if(cell.checked) { alert(cell.getAttribute("label")); var x = cell.getAttribute("label"); x = window.arguments[0]; // or cell.label } } window.close(); } </code></pre> <p>This is the code for the check-box values created dynamically:</p> <pre><code>function choose() { //alert('hi'); var tree = document.getElementById('myTodoListTree'); for (var i = 0; i &lt; tree.view.rowCount; i++) { if (tree.view.getCellValue(i, tree.columns.getColumnAt(0)) == 'true'){ var empty = " "; var contact = (tree.view.getCellText(i, tree.columns.getNamedColumn("name"))+ empty+ tree.view.getCellText(i, tree.columns.getNamedColumn("lastname"))+ empty+ "Contacts:"); var ggmail = tree.view.getCellText(i, tree.columns.getNamedColumn("gmail")); var yyahoo = tree.view.getCellText(i, tree.columns.getNamedColumn("yahoo")); var existingEl = document.getElementById('box'); var capt = document.createElement('groupbox'); existingEl.appendChild(capt); var captionEl = document.createElement('caption'); capt.appendChild(captionEl); captionEl.setAttribute('label', contact ); captionEl.setAttribute('style', 'color: blue;'); var existing = document.getElementById('box'); var checkbox = document.createElement('checkbox'); capt.appendChild(checkbox); checkbox.setAttribute('label', ggmail ); checkbox.setAttribute('style', 'color: green;'); var existing = document.getElementById('box'); var checkbox = document.createElement('checkbox'); capt.appendChild(checkbox); checkbox.setAttribute('label', yyahoo); checkbox.setAttribute('style', 'color: green;'); } } return arr; } </code></pre> <p>Here the user select the check-box in the "tree.xul" file and I have button("function get()") to add the values to the text-box in the "texbox.xul" window.</p> <p>This is the function to open the tree.xul from the text-box.xul file:</p> <pre><code>function DisplayContacts() { var returnValues = { out: null }; window.openDialog("chrome://hello/content/sundayevening2.xul","sundayevening2","", returnValues); } </code></pre> <p>Please help me to pass the values to the text-box in another XUL window.</p> <p>Thanking you.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload