I want to check while saving DCR, if the,
- DCR already exists
- & also if value of one of its field "Title" if it exists in the DB.
I was able to achive the checks using a call to callserver on save event as below.
------------------- FormAPI
IWEventRegistry.addFormHandler("onSaveValid", dcrSave);
...
function validateName() {
var server = window.location.hostname;
var params = new Object();
var Titlename = IWDatacapture.getItem("Title").getValue();
params.url = Titlename;
callS = "http://" + server + "/iw-bin/validateTitle.ipl";
IWDatacapture.callServer(callS, params, true);
}
function dcrSave()
{
validateName();
}
------------------- validateTitle.ipl
...
sub sendMsg
{
my ($result, $titleName) = (
@_);
&writeHeader;
if ($result != 0){
print "alert('Title Name already exists');\n";
}
&writeFooter;
}
-------------------
With validateTitle.ipl as above, I can now send alert to user in case DCR exists or Title is already in database. But in case when these conditions are not true, how can I open the regular DCR save window for the user to select the folder & save the DCR with the desired name (The typical save operation). In short how can I pass the control back to the calling js for operations after callserver.
Thank you
Chary