Hi All,
I am auto saving a DCR based on the field name inside DCR. But before doing that, I am trying to check to see if a DCR by that name is already existing. If yes, then there is an alert to the user to change the content of that particular field. I am using a Call server to see if the file already exixts in the folder. The problem here is that the CGI script is not getting triggered on the invocation. Can any one help me on this?
Thanks!
JS Code:
var savnm = replaceSubstring(IWDatacapture.getItem("/newsTitle").getValue(), " ", "");
var params = new Object();
params.savnm = savnm;
IWDatacapture.callServer("/iw-bin/general/validatesave.cgi", params, true);
//alert(savnm);
var tmp = IWDatacapture.getItem("/allowsave").getValue();
if (tmp==1){
alert('File with the title name alreaddy exists. Please change the title field value');
return (false);
}
saveFile(replaceSubstring(IWDatacapture.getItem("/newsTitle").getValue(), " ", ""));
dcrNameCheck(new Array("/newsTitle"));
return true;
DCT Code:
[html]
[/html]
CGI Code:
[html]
use CGI;
use TeamSite::Config;
use TeamSite::CGI_lite;
### Get the location of iwhome
my $iwhome = TeamSite::Config::iwgethome();
$|=1;
my $cgi = TeamSite::CGI_lite->new();
$cgi->parse_data();
$allowsavevar = '/allowsave';
$intvalue = $cgi->escape_html_data($cgi->{form}{savnm});
$file = "/iwmnt/default/main/dev/WORKAREA/templatedata/****/data/".$intvalue;
$value = "0";
if(-e $file){
$value = "1";
}
### Return the value to the function in the Form API script
print <
<script language="javascript">
// Get handle to the FormAPI/userscript frame.
api = parent.getScriptFrame();
// Set the hidden field value
api.IWDatacapture.getItem("$allowsavevar").setValue('$value');
</script>
EOF
### Close the script
exit;
[/html]