I have a php page that contains this block of code:
echo '<div id="popup" style="display:none">'; echo '<form id="AddForm" name="AddForm" method="get">'; echo '<table><tr>'; echo '<td>Software Name: </td><td><input type="text" id="SoftwareName"/></td></tr>'; echo '<tr><td>Software Type:</td><td><input type="text" id="SoftwareType"/></td></tr>'; echo '<tr><td>License Method:</td><td><input type="text" id="LicenseMethod"/></td></tr>'; echo '<tr><td><input type="button" value="Add" OnClick="opener.GetAddData();"></td><td></td>'; echo '</tr></table>'; echo '</form>'; echo '</div>';
Buttan, which calls CreatePopup () :
echo "<input type='submit' value='Add' OnClick='CreatePopup();'/>";
I open this div as a popup using the following code:
function CreatePopup() { var w = null; w = window.open('index.php?List=SoftwareLicenseAllocations', 'test', 'height=125,width=300'); w.document.write( $("#popup").html()); w.document.close(); }
Code that gets text field values ββfrom a popup:
function GetAddData() { var SoftwareName = document.getElementById('SoftwareName').value;//.getElementById('SoftwareName').value; var SoftwareType = document.getElementById('SoftwareType').value; var LicenseMethod =document.getElementById('LicenseMethod').value; alert(SoftwareName, SoftwareType, LicenseMethod); AddNew(SoftwareName,SoftwareType,LicenseMethod); }
Screenshot:

Whenever I call GetAddData () and paste the text into the popup and press the button, the values ββremain empty.
Why is this happening? How to get text box values?
I am using Pear PHP and a modified version of OpenIT (and the old CMS asset management).
source share