I have a Form API script that performs 2 callServers for auto-naming DCRs and then setting up and generating the HTML files for the DCR. The first callServer is working great...the script calls it, it returns the values expected and the script continues. The second one is being called and all of the code in the CGI is being completed...it just isn't calling back to the script for some reason.
The first one is called onSave and the second is called onSaveDone. Here is some of the code in question:
FORM API SCRIPT
// Call an external script to generate the output file
var pt = IWPageGeneration.getPresentationTemplate();
var ptfile = pt.getName();
var htmlfile = IWPageGeneration.getOutputFile();
var parameters = new Object();
parameters.datatype = "MainContent";
parameters.dcrpath = dcrpath;
parameters.pt = ptfile;
parameters.htmlfile = htmlfile;
alert("About to Call Server\nPT is " + ptfile);
IWDatacapture.callServer("/iw-bin/ama/generateOutputFile.cgi", parameters, true);
function completeFileGenerationProcess(htmlpath) {
alert("Returning from Call Server\nConfig Contents is " + config_contents);
alert("The DCR has been saved.\n\nThe following file has been generated as well:\n" + htmlpath);
return true;
}
CGI SCRIPT
### Run the command and log the results
my $gencmd_results = `$gencmd 2>&1`;
if ($gencmd_results) {
print LOG "Generating the HTML file failed for $htmlpath:\n$gencmd_results\n\n";
close LOG;
exit;
} else {
print LOG "Generating the HTML file succeeded for $htmlpath.\n\n";
}
### Close the log file
print LOG "### Completing Generate Output File Script ###\n\n";
close LOG;
### Return the value to the function in the Form API script
*** REPLACED ALL LEFT ANGLES WITH SQUARES ***
print [[EOF;
[html>
[head>
[/head>
[body onload="parent.getScriptFrame().completeFileGenerationProcess($htmlpath)">
[/body>
[/html>
EOF
### Close the script
exit;
If anyone can offer any suggestions to help get my callServer to return properly, I'd appreciate it.
Thanks!