All, I have a form that is displayed on the web. I have a main form with a button and a computed field, we will call FIELD1. When I click the button, I have a popup box with 1 text field, an OK and Cancel button on it. I would like to transfer the text value in this popup field back to the main form in FIELD1.
I have seen several posts here on the forum, however, nothing has either not made any sense or did not work.
How do I get this value back to the main form from the popup box. Do I need to first some how get a hold on Field1 in the button, and add it to the ppopup form?
I have tried this:
function OKClick()
{
opener.parent.document.forms[0].FIELD1 = doc2.POPUPFIELD[0].value;
window.close();
}
But get a JS error that opener.parent.document.form.0 is null or not an object…
Thanks for any advice anyone can offer.
David
Subject: Returning value of text field on popup box back to main form on web
If there IS an opener.parent, it is probably a frameset document that does not contain a form. If you are not using a frameset, then there probably is no parent.
Subject: Returning value of text field on popup box back to main form on web
OK , a few things here. On the Main form, if the field called FIELD1 is computed, you won’t easily be able to reference that from your popup. Personally I’d make it editable and if you don’t want someone actually editing it, place this.blur() in the onFocus event of the field.
Secondly, to launch the popup window from the Main form, use something like:
popupWindow=window.open(‘yourURLtoYourForm’,‘windowName’,‘resizable=no,width=400,height=300’);
if (popupWindow.opener == null) popupWindow.opener = self;
then in your popup form, set your OK button’s onClick event to something like this:
var popupWinTxtFieldValue = document.forms[0].myFieldName.value;
opener.document.forms[0].FIELD1.value = popupWinTxtFieldValue;
window.close();
Patrick
Subject: RE: Returning value of text field on popup box back to main form on web
Patrick,Thanks for the response that worked perfectly! I guess I will just have to deal with the field1 being editable, with the onfocus blur.
David