getItem() is returning null

Options
SriniYA
edited July 20, 2021 in TeamSite #1
I would like to validate the DCR. I have the following code in the datacapture.cfg file. titleItemName alert is returning null.

Can someone suggest what I need to do to fix this

Thanks in advance.
Sri

IWEventRegistry.addItemHandler("/Section/Container/Selected", "onItemChange", doValidateForm );
IWEventRegistry.addFormHandler("onSave", saveHandler);


//*********************************************************************************************
// saveHandler
//*********************************************************************************************
function saveHandler(button) {
var button_fun_status;
switch (button) {
case IWDatacapture.SAVE_BUTTON:
{
//alert("User clicked on save button");
button_fun_status = doValidateUserInput();
break;
}
case IWDatacapture.SAVECLOSE_BUTTON:
{
//alert("User clicked on saveClose button");
button_fun_status = doValidateUserInput();
break;
}

}

if (button_fun_status) {
alert ("returning true");
return true;
} else {
alert ("returning false");
return false;
}
}


//*********************************************************************************************
// doValidate User input
//*********************************************************************************************
function doValidateUserInput() {
titleItemName = IWDatacapture.getItem("/Section/Container/Selected/Title");
alert ("titleItemName" + titleItemName);
titleItemValue = titleItemName.getValue();
alert ("titleItemValue: " + titleItemValue);

}

Comments

  • Can you attach/post (without markup/html) the DCT?
  • I have attached the file

    Thanks
    Sri
  • Could you attach the DCT as well? Maybe your path/item name is incorrect but it is impossible to say without the DCT...

    Cheers
    Michael
  • IWEventRegistry.addItemHandler("/Section/Container/Selected", "onItemChange", doValidateForm );
    titleItemName = IWDatacapture.getItem("/Section/Container/Selected/Title");


    If we see the above two lines what is the name of the field ? selected or title ?
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs