I have a form action that opens a child window on the web with the following code:
var url = '/database.nsf/ChildForm?OpenForm
parentWin=window.open(url,‘Title’, ‘menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes, copyhistory=no,width=375,height=375,left=375,top=5’);
parentWin.opener=self;
This works fine except that I’d like for the parent form action to pass a value (for example, ‘New’) to a field on the child (‘TestField’). I’ve therefore replaced the first line in the above code with the following. (‘TestField’ is an editable field on the child form.)
var arg = “New”;
var url = ‘/database.nsf/ChildForm?OpenForm&TestField=’ + arg
Neither this code nor several variations of it that I’ve tried have provided the intended result.
I’d appreciate any ideas on how this code might be modified so that the parent form action passes a value to a field on the child window.
Thanks.
Subject: JavaScript for Opening a Child Window
There’s more to setting a value server-side than including it in the URL. Oddly enough, I just finished posting something similar in the R4 & R5 forum:
http://www-10.lotus.com/ldd/46dom.nsf/0/f6628426a37a8f138525703e000f1f7c
However, if the field you’re after is editable, you can set it after the window opens:
parentWin.document.forms[0].FieldName.value = ‘whatever’;
(or a suitable variation for setting radios, checkboxes or selects).
Subject: RE: JavaScript for Opening a Child Window
Oh, yeah – in Domino 6 you can use @URLQueryString(“parameterName”) instead of creating the Query_String or Query_String_Decoded fields and parsing from that. The major advantage to the new method is that the parameter name is not case-sensitive. Parsing manually-entered URLs is a major pain in the butt – you have to take the user’s input value as gospel, but you need to check every possible case of the actual parameter name, so you can’t just use @LowerCase, @UpperCase or @ProperCase against the query string when parsing.