Home
TeamSite
Check File Exist
Mali
Hi All,
I'm using Form API to save DCR with the desired name (a hard-coded name).
This is my code.
----------------------------------------------------------------------------------------------------------
function initAutoNameDCR() {
IWEventRegistry.addFormHandler("onSaveValid", handleNameDCR);
}
function handleNameDCR() {
var dcrName = "";
dcrName = "my_file_name";
if(IWDCRInfo.getDCRName() == "") {
IWDCRInfo.setDCRName(dcrName);
}
return true;
}
initAutoNameDCR();
----------------------------------------------------------------------------------------------------------
This code works fine and saves the DCR as "my_file_name". But my reuirement here is, when user again do "File > New Form Entry", and when saving it, I need to invoke an alert saying the file name already exisitin, do you want to overwrite it? (as asked when you invoke Save AS).
But currently the code just overwrites on top the of the existing DCR.
I just want to alert the user that the DCR already Exists.
Can anybody help me on this?
m. a. l. i.
TS 6.1 Win2k3
Find more posts tagged with
Comments
kshitiz
I had implemented the same functionality some time back. But I was calling an ipl using formapi callServer() which generates the name of the DCR based of some parameters. The ipl also check whether there is already a file existing with the same name.
If yes, it would callback a javascript function which will prompt to the user if he wants to overwrite the file.
If yes, then setDCRName() to the returned name.
If no, it will not save the DCR.
Hope this helps !!
Kshitiz Sharma
BT Wholesale | CMS
Mahindra British Telecom
kshitiz
For your reference I've attached a sample code
Kshitiz Sharma
BT Wholesale | CMS
Mahindra British Telecom
Mali
Thanks a lot..This is very useful.
m. a. l. i.
TS 6.1 Win2k3