Issue: 
The form has a field that contains the name of a field. You want to get the field name and then get the field itself to write a new value to it. 
 
Solution: 
 
var thisfrm; 
var openfrm; 
var openerSendTo; 
 
// setup forms for this dialog and the form in the originating/parent window 
thisfrm = document._FormName; 
openerform = window.opener.document._FormName; 
 
// setup working variables 
openerSendTo = eval('openerfrm' + thisfrm.tmpSendToFld.value);	// tmpSendToFld contains name of field to load 
 
... do some code ... 
 
// update opener SendTo field 
openerSendTo.value = thisfrm.tmpSendTo.value 
 
// optionally refresh based on new value 
// window.opener._doClick('$Refresh', this, '_self', '#RefreshKW_' + openerSendTo.name) 
 
// close this dialog 
self.close(); 
 
 
Second Solution: 
Using a hidden flag field, get from that field, the name of a second field. 
Using the name get the second field. Looping through [elements] on form isn't an option. 
  
Solution: 
Use the Eval. See code sample below. 
  
f=documents.forms[0]; 
var vfldnm = f.FlagFld.value; 
if(vfldnm !="") { 
  var vfld = eval('f.' + vfldnm); 
  ... do reset of code here ... ; 
 } 
 
 
 
  
previous page
 
  |