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)
Running some perl from formapi
tsrookie
Gidday all,
I have written some formapi stuff to set the dcr name based on the user selection from a drop down box.
What I want to do is now do some scripting to check to see that they haven't already saved a dcr with the chosen name, I assume perl is the way to go?
My formapi stuff is below
function init(){
// register some event handlers
IWEventRegistry.addItemHandler( "/menuTitle", "onItemChange", setDCRName );
}
function setDCRName(item){
dcrName = item.getOptions()[item.getValue()].value;
IWDCRInfo.setDCRName(dcrName);
return true;
}
init();
Find more posts tagged with
Comments
gzevin
TeamSite iself will warn if youi attempt to overwrite an existing file? or I am missing something?
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
tsrookie
Thanks Greg,
yes I know TS warns you if you try to overwrite an existing file,
Because the name of the dcr is determined by the users selection of the item in the drop down list this seemed like an obvious place to check and see if a dcr of that name already existed.
Cheers
Colin
gzevin
in ANY case you can never be sure that this name is unique, till the very moment of the save event - and who guarantees that 2 and more separate users don't oi it at the same time? A slight possibility, but if there is a business rule for it, everything should be taken into account
so, basically, even if you check on the name, only implementing locking mechanisms will ensure the uniquness. Or some other (similar though) techniques - like implementing a counter in a locked file (as we do it).....
Greg Zevin, Ph.D. Comp. Sc.
Independent Interwoven Consultant/Architect
Sydney, AU
Adam Stoller
BTW - to slightly answer part of your question - if you're doing this all within FormAPI you can't use Perl - however, in order to check the existance of a file on the server from FormAPI - you'd end up doing a CallServer() [which runs *asynchronously*] to invoke a script on the server - and *that* could be written in Perl.
As to the mechanics and headaches involved - I think Greg has already touched on those.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
hitc
you can use an inline on a perl script that will check all the dcr that exist in the data directory and generate formapi script between 2 substitions tags.I made it and it is working fine but it is not perfect because if someone else create a dcr with the same name during your edition,the test will not work.But it is better than nothing.