Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
onSaveDone
Mich
The following function deploys my dct to the database on the event handler onSaveDone but the dcr name does not get sent as a parameter for some reason even though I have typed in a dcr name. I thought the getDCRName would return the name i typed but it returns empty. Therefore all my dcrs are getting deployed. Any ideas?
function deploy()
{
var originalDcrName = IWDCRInfo.getDCRName();
var params = new Object();
params.dcrName = originalDcrName;
params.workareaPath = getWorkarea();
params.categoryDatatype = getCategoryAndType();
IWDatacapture.callServer ("/iw-bin/custom/NoticeDeploy.ipl",params);
}
Find more posts tagged with
Comments
Jens
I had a similar problem, but one solution is to save the DCR again before deploying.
function init() {
IWEventRegistry.addFormHandler( "onSaveNameSpecified", saveName );
}
function saveName(path){
var VPath = path.split("/data/");
DCRNAME = VPath[1];
saveDCR();
return true;
}
function saveDCR(){
IWDCRInfo.setDCRName(DCRNAME);
IWDatacapture.save();
return true;
}
function saveDone(saveSuccessful){
if(saveSuccessful){
....
....
IWDatacapture.callServer("/db1-bin/doDataDeploy.cgi", params, true);
}
}
Mich
Is onSaveNameSpecified an Interwoven Event?
Jens
Yes, it is documented in FormAPI-Docs:
http://TEAMSITE-SERVER/iw/help/tst/formapi/formapi_30.html#SEC30
Mich
Many thanks that worked a treat - had been looking at an old copy of FormApi so had not known about onSaveNameSpecified. Thanks so much.
Migrateduser
you didn't add a formhandler for the savedone ..??
how can this work ..?
Migrateduser
ok let's imagine we've got a formhandler added when exactly we'll enter the piece of code within the if(savedsuccess) ...?
thanks
Jens
It was an example for "onSaveNameSpecified". I had much more functionality in my script.
So, i had also added the "onSaveDone"-Event:
IWEventRegistry.addFormHandler( "onSaveDone", saveDone );
You'll enter "if(savedsuccess)" after SaveDone, so the DCR is saved and then you got savedsuccess=true.
Migrateduser
and when will we "enter " the piece of code out of if(savecussess) scope ..?
Jens
same time, because you have a SaveDone event.
Migrateduser
think there's a missunderstanding
ok let's say i have a savedone handler like :
function onSave(savesuccess) {
var Idtem = IWDatacapture.getItem("/Id");
if(savesuccess){
if(Idtem.getValue() == ""){ // prevent calling twice the call server
var params = new Object();
var area = parent.gTDT;
IWDatacapture.displayMessage("Determing Id...");
top.hiddenFrameRunning = true;
var server = window.location.hostname;
params.area = area;
IWDatacapture.callServer("http://"+server+":9095/iw-bin/iw_cgi_wrapper.cgi/genID.cgi", params);
}else{
alert("not success save");
}
return true;
}
well i noticed i never get the alert("not success save");
so why do i need the savesuccess boolean ,,?
second question : my cgi script manages id an then i set the value of a dct 's textfield with this id generated.
The problem is once i click save button and then the close button i get the following message "You have not saved your changes.Are you sure you want to close ?
If i click again the save button and the close button then it's ok the dct window closes and the id generated is stored ...why do i need to click again the save button ..?
thanks
In.pdf
Out.pdf
Jens
I think it's because you change your DCR by setting the ID after you saved the DCR.
You have to set the ID before you go to saveDone.
Migrateduser
you may be right will try with the onsavevalid event
Migrateduser
nope onsavevalid it doesn't set the id ...?
Migrateduser
strange behaviour :
onsavevalid my "callback" ( actually a function that will receive some paramaters back from the cgi script ) is not even called ...!!
so intrigated
Migrateduser
this is [censored] crazy it works on the onsavevalid and onsave events if i put a timeout..but then when i click the close button still have the message as if the system didn't consider any change ..fdon't get it
Migrateduser
everything works well when we click the saveas and save and close button ...why ..?
Migrateduser
Hi,
I am using the below statement before my callServer call.
IWDatacapture.displayMessage("Loading All ProductModels ...");
after my callServer call i am using this statement
IWDatacapture.displayMessage();
I am not seeing the message on DCR.
It seems to be i have to use callback in this case. Can u send me example how to solve this. Basically here i want to get callback from my cgi to formapi.
Thanx in advance