Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
onSaveNameSpecified
System
Hi,
Using formapi onSaveNameSpecified on this event i want to check whether file existing in the current directly or not.
Actually when i try to save with existing name it will check by default but in my case i typing filename for example as test.So it will check whether test is existed or not.
But while saving the dcr i am adding workareaname_test.
So in the onSaveNameSpecified when i typed the name i want to add workareaname to it then i want to find out the whether new named file is existed or not.
Any idea how to do this
Thanx in advance
Find more posts tagged with
Comments
Migrateduser
If you can be sure that the browser is a recent IE you can use the the XML parser that comes with it, sample code at
http://devnet.interwoven.com/data/forums/attachments/39-12034-post.txt
Migrateduser
Thanx for your info. this helps.
I have one more question here.In this script in onSaveValid if dcr name is null we are constructing the dcr name with predefine formula ?
In my case i want to add to prefix to the dcrname( which is entered by the user).
Once the user enter the name i want to add prefix and test whether this dcr existed or not.
This code pretty similar i am trying modify according my situation.If you have any idea pls. let me know.
In given code dcr name is presetting with dcr item am i right ?
Any way thanx once again for your post
Migrateduser
Yes that code is defaulting DCR name based on a value entered into a field, you would probably want to do something similar.
Migrateduser
Hi,
In onSaveNameSpecified event i am trying to check if the file exists .
It is returning alway false for this statement eventhough same file exists ?
xmlDoc.load( xmlFile ) -> false
Here is the code .
var fname="sample";
// This is the XML file pertaining to the
// DCR. This will be used to determine if
// the DCR already exists,
var xmlFile = window.location.protocol
+ "//"
+ window.location.hostname
+ ":81/iwmnt"
+ getWorkarea()
+ "/repository/"
+ getCategoryAndType()
+ "/data/"
+ fname;
alert('XMLfile[' + xmlFile + ']');
// Use Microsoft XML parser to determine if the
// DCR already exists.
var xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
xmlDoc.async = false;
xmlDoc.validateOnParse = false;
xmlDoc.resolveExternals = false;
if ( xmlDoc.load( xmlFile ))
{
result = confirm( "File " + fname+ " exists; press OK to overwrite it or Cancel to pick a new name." );
}
Thanx in advance
Migrateduser
I think there are some problems with the path you are constructing.
After defining var xmlFile add an alert or setMessage (can't remember the function name offhand), copy that value into a browser. When you get the path to an existing file right you will see an invalid XML message in the browser (because the DTD reference is invalid) - that means the logic you are using to construct the file path is right.
I think iwmnt should be iw-mount.
I think repository should be templatedata.
Also if your webserver is not running on port 81 you would want to change that value.
Do you need a directory name before fname?
var xmlFile = window.location.protocol
+ "//"
+ window.location.hostname
+ ":81/iw-mount"
+ getWorkarea()
+ "/templatedata/"
+ getCategoryAndType()
+ "/data/"
+ fname;
An alternative might be to use callServer - can't remember if that is syncrhonous or asyncrhonous though.
Migrateduser
Hi,
Thanx for your reply
we have instead of iw-mount we have it as iwmnt
and instead of templatedata we have repository
fname is the dcrname and "/data/" is the directory.
Is this xmlFile is path to dcrname am i right ?
Thanx once again for your reply
Migrateduser
xmlFile is not the path to the DCR it is a URL for accessing the DCR through your webserver. So while on the filesystem you may have iwmnt the virtual directory in your webserver is probably iw-mount.
On repository vs. templatedata you are saying that in iw.cfg you have:
[teamsite_templating]
data_root=repository
is that correct?
Migrateduser
u r right my data-root is repository
Thanx for your info
Migrateduser
Thanx for your info. It works