You need formapi and a callserver to do this.It is pretty easy, I do similar often. One example is I have a field that defines the save path, onSave event kicks off a callserver to an ipl that creates directories if needed, and rejects if the file exists. What have you tried ?
Hi Nipper,My idea is to use a hidden field in the dct and update its value from the CGI. Depending on the value of the hidden field, I can validate the form, whether to save it or not.I was able to get the value of the field to the CGI, but still working on how to update the value of the hidden field.Is there any way, you could share the code snippet Thanks!Jenni
var pFrame = top.opener.parent.getScriptFrame(); print "pFrame.IWDatacapture.getItem(\"$ItemName\").setValue(\"$itemValue\");\n";
While what Kaalraa posted will work and solve your problem, I never write like this and suggest others do not as well. Shameless advertising - this will be in my GearUp preso on TST best practices.Basically the issue is that callservers are now very common and callback routines are typically required. Write a general purpose callserver utility that you can reuse the code (not with cut and past but as a library) that passes parameters as well as the callback function (the FormAPI funtion to execute when the callserver completes). It should pass the data and execute the setValue for you.
Hi,Thanks for the reply. Here, I am not opening any 2nd window for display. Just I will do my validation in the call out program(ipl) and I would like to change the value of parent form field(hidden variable) before completing this ipl.Thanks!Jenni
CallServer is a Asychronous Procedure call(APC).To understand in depth follow,http://en.wikipedia.org/wiki/Asynchronous_procedure_callWidely used APC implemention is AJAX.http://en.wikipedia.org/wiki/AJAX
That is not how callservers work. It runs one the server and passes information back to the client with a formapi command (like he showed) or passing a variable to a callback function which is how I typically do it.No windows are opened everything is in the background.
Hi Nipper,Thanks for the reply. Do we have any example for using in the background(no visual form)?Thanks!Jenni
top.hiddenFrameRunning = false; var params = new Object(); params.callBack= "returnFunction"; params.someData = 12; progName = "blah.ipl"; // Execute the remote server call var server = window.location.hostname; var URL = "http://" + server + ":80" + "/iw-bin/" + progName; IWDatacapture.callServer(URL, params, false);}
function returnFunction(newData){ var item=IWDatacapture.getItem("/Root/HiddenItem"); item.setValue(newData);}