Javascript sent to form textbox
Posted: Tue Sep 26, 2006 3:31 am
Hi All,
I have a line of javascript code that works from a query builder I have adopted from a colleague. Basically, the query is built in php in a popup window. THis is then added to a form element on the popup window, and the submit button is pressed.
Upon the submit button being pressed, the sql code in the text box, is sent to a text box on the opener form and the popup window is closed.
This works okay using the following javascript code
The popup form closes and my textbox is populated with the correct value that was in the previous textbox.
What I am struggling to do now is to get the value of the text box on my original form into a variable. Im guessing that I need to submit the main page form containing the text box.
I could add a submit button, but would like to automate this by having the opener page refresh and submit the new form variable using
$qryValue = $HTTP_POST_VARS['myTextField'];
Does anybody have any idea how I can achieve this, or is there a possible workaround, by sending the query to the caller page as a URL value.
Please go easy Im a newbie.
Many Thanks
Jamie
I have a line of javascript code that works from a query builder I have adopted from a colleague. Basically, the query is built in php in a popup window. THis is then added to a form element on the popup window, and the submit button is pressed.
Upon the submit button being pressed, the sql code in the text box, is sent to a text box on the opener form and the popup window is closed.
This works okay using the following javascript code
Code: Select all
function copyForm() {
opener.document.hiddenForm.myTextField.value = document.popupForm.myTextField.value;
window.close();
return false;
}What I am struggling to do now is to get the value of the text box on my original form into a variable. Im guessing that I need to submit the main page form containing the text box.
I could add a submit button, but would like to automate this by having the opener page refresh and submit the new form variable using
$qryValue = $HTTP_POST_VARS['myTextField'];
Does anybody have any idea how I can achieve this, or is there a possible workaround, by sending the query to the caller page as a URL value.
Please go easy Im a newbie.
Many Thanks
Jamie