Anton Hinxman
|
Posted: 12/14/2004, 9:11 AM |
|
Yep, been there and seen it also in CCS demo, plus reported it as a problem to CCS a year or so ago. In the CCS demo you get this problem if you want a Mc'Donald to be a manager. The quote just makes a mess of the JavaScript (or rather the expansion of {field} into HTML/JavaScript for the page).
CCS did not have a fully satisfactory answer to this because no matter what you try to do expanding the field content into the JavaScript can always end with trouble.
So what's the answer?
Go back to the document object and use object id values for the three things you want to pass:
<HIDDEN TEXTBOX bound to trainee> id=trainee
<READONLY TEXTBOX set to text converted from id to text of first name> id =traineefirst
<READONLY TEXTBOX set to text converted from id to text of surname> id =traineesurname
In your JavaScript, used to open popup box of trainee student list, you can examine the document of IE and get the id value from the hidden and labelled control 'trainee':
trainee=""+document.getElementById("trainee").value
You can mess with all the parent document control values when the user makes a choice of student on the popup.
<script language="JavaScript">
function SetOpenerValue(traineeFirst,traineeSurname,StudentId)
{
if(window != null && window.opener != null) {
if(window.opener.document.the_record_is_here != null) {
window.opener.document.the_record_is_here.studentid.value = StudentId;
window.opener.document.the_record_is_here.traineefirst.value = traineeFirst;
window.opener.document.the_record_is_here.traineesurname.value = traineeSurname;
}
window.opener.focus();
window.close();
}
}
</script>
Note the_record_is_here is your record name.
You can update back to the parent object model in IE rather than 'fight' with the JavaScript parameter passing CCS has. If fields come from data raw and un-escaped out of CCS then you will always get some problems with the CCS method.
IMO you have to do all your work using the IE object model.
Hope that this helps.
Not as easy as it should be!
Regards
Anton Hinxman
|