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)
Form API getModificationdate
rpillai
I have a problem in Teamsite Form API. Any help is greatly appreciated.
Requirement:
The last modified date of a DCR has to be displayed as a field in the DCR.
Issue:
The function "getLastModifiedDate" currently returns the last modified date of a DCR. At any instant when the DCR is modified it returns the date when the DCR was modified last. The date returned is then stored in the DCR. But, when the DCR is opened the next time, the date that will be displayed is the modification date of the last but one time and not the last time.
In order to display the modification date, currently the "getLastModified" function is being written inside a trigger that is executed when the DCR is loaded. Thus, when the DCR is opened in "Edit" mode, the trigger is invoked and the correct modification is displayed. But, when the same DCR is opened in "View" mode, NO triggers are invoked. Hence, the modification date displayed in "View" mode is the last but one time the DCR was modified.
code section
<item name="Date_Last_Modified">
<description>Date Last Modified</description>
<label>Date Last Modified</label>
<text required="f" maxlength="20" size="20" />
</item>
<script>
<![CDATA[
//IWEventRegistry.addFormHandler("onItemChange", setDateOnEdit(IWDatacapture.getItem("/Date_Last_Modified")));
IWEventRegistry.addItemHandler("/Date_Last_Modified", "onItemChange", setDateOnEdit(IWDatacapture.getItem("/Date_Last_Modified")));
IWEventRegistry.addFormHandler("onSaveDone", setDateOnSave(IWDatacapture.getItem("/Date_Last_Modified")));
function setDateOnEdit(item) {
//alert(IWDCRInfo.getDCRName());
item.setReadOnly(true);
date = IWDCRInfo.getModificationDate();
if(date == null)
{
item.setValue(" ");
item.setVisible(false);
}
else
{
item.setValue(date);
}
}
function setDateOnSave(item) {
date = IWDCRInfo.getModificationDate();
item.setValue(date);
}
]]>
</script>
Find more posts tagged with
Comments
Migrateduser
You probably want to change the value before onSaveDone (maybe onSave).
descriptionfile.dsc