datadoit.com
|
| Posted: 06/12/2007, 10:03 AM |
|
PHP5; CCS3.1
I have an editable grid, and on each row I have an image link which will
open a lookup form. I used the example from the ExamplePack, PopUpList.
I have it working, but my problem is that I'm referring to the calling
field as getElementById("myfield"). Well, when selecting a new value
from the popup search form, it gets returned back to the editable grid
on the first row, not on the calling row.
Hope this makes sense to someone. How do I refer to the proper editable
grid row + field when making the call to the popup and the subsequent
return with the new value?
|
|
|
 |
datadoit.com
|
| Posted: 06/12/2007, 3:05 PM |
|
I have this figured out. I'll post the solution for anyone that cares
later. I'd like to make it a little 'tighter'. Does anyone have a
suggestion as to how to rewrite this javascript?
switch(rownum) {
case 1:
window.opener.document.myform.myfield_1.value = FieldValue;
break;
case 2:
window.opener.document.myform.myfield_2.value = FieldValue;
break;
case 3:
window.opener.document.myform.myfield_3.value = FieldValue;
break;
}
|
|
|
 |
RonB
Posts: 228
|
| Posted: 06/21/2007, 6:50 AM |
|
I have a somewhat different aproach. I ad an id tag for the controll wich well receive the search result:
id={controll_name}
codecharge substitutes that with the controll_name_1 ,controll_name_2 naming convention. So now you not only have a unique name but allso id for that controll. I place a search button beside that controll wich will open a popup search window :
onclick=window.open('search.php?controll={controll_name}',etc etc)
This means that the controll name is send to the search popup as a parameter. I use that to make sure that an onchange event inserts the result in the right controll on the parent page:
onchange=parent.document.formname.{controll_name}.value=this.value
the {} gets inserted via a before show event and the $Tpl structure:
//before show page...
global $Tpl;
$Tpl->setvar("controll_name",CCGetParam("controll_name",""));
Ron
|
 |
 |
|