var newDcrName=""; if(IWDCRInfo.getDCRName() == "bs_bName.xml") { IWDCRInfo.setDCRName(newDcrName);
Strange, No i'm not seeing any alert popping upfunction saveDone(success) { if (! success) { alert ("Filename +"IWDCRInfo.getDCRName()); alert("The save did not succeed ..."); }}
Hi Kaalra here is dct attached. Thanks for your help.
Hi Kaalra here is dct below. Thanks for your help. <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd"><data-capture-requirements name="test" dtd-system-identifier="" dcr-validation="reject-invalid"> <ruleset name="dct"><script language="javascript" location="template-type" src="test.js"/> <root-container location="test" name="test"> <item name="uid" pathid="@uid" label="" min="1" max="1" required="t"> <text size="50" maxlength="100" /> </item> <item name="name" pathid="@cName" label="Name" min="1" max="1" required="t"> <text size="50" maxlength="100" /> </item> </root-container> </ruleset></data-capture-requirements>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE datacapture SYSTEM "datacapture6.0.dtd"><data-capture-requirements name="test" dtd-system-identifier="" dcr-validation="reject-invalid"> <ruleset name="dct"><script language="javascript" location="template-type" src="test.js"/> <root-container location="test" name="test"> <item name="uid" pathid="@uid" label="" min="1" max="1" required="t"> <text size="50" maxlength="100" /> </item> <item name="name" pathid="@cName" label="Name" min="1" max="1" required="t"> <text size="50" maxlength="100" /> </item> </root-container> </ruleset></data-capture-requirements>
location="template-type"
test.js
datacapture.cfg
Ok Guys Here are original files (dct and js file). js file lives in same directory as dct. Alert is still not showing up as seen in js file. Thanks for helping.
// Do the initialization...IWEventRegistry.addFormHandler("onFormInit", init);function init() { IWEventRegistry.addFormHandler("onSaveNameSpecified", nameChosen); IWEventRegistry.addFormHandler("onSaveDone", saveDone);}function nameChosen() {var newDcrName; if(IWDCRInfo.getDCRName() == "cv_cName.xml") { IWDCRInfo.setDCRName(newDcrName); return true; } else { alert("The filename chosen is invalid ..."); return false; }}function saveDone(success) { if (! success) { alert ("Filename +"IWDCRInfo.getDCRName()); alert("The save did not succeed ..."); }}
newDcrName
IWDCRInfo.setDCRName(newDcrName);
...function nameChosen() {alert("in nameChosen"); var newDcrName;alert("current DCR name: '" + IWDCRInfo.getDCRName() + "'"); if(IWDCRInfo.getDCRName() == "cv_cName.xml") {alert("DCRName matched test"); IWDCRInfo.setDCRName(newDcrName);alert("DCRName reset"); alert("New DCRName: '" + IWDCRInfo.getDCRName() + "'"); return true; } else { alert("The filename chosen is invalid ..."); return false; }alert("This should never show up");}
I get alert from other dct and js file in other branch.
Thanks Boris alerts are now popping up, but when I try to save dcr as cv_cName.xml it still says filename chosen is invalid. I'm trying to see why is this.
Hey Boris I have tried setting var newDcrName="cv_cName.xml" and var newDcrName="" in js file and neither of them works...