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)
Form API and setting hidden field
dazzlad
Hello People,
I am having an issue setting a hidden field with the formAPI (TS 6.1 sp2 on windows 2003 server).
I use the following code to set the value of a hidden field (portal_event_date)
the alert(arChildren
.getValue()); works and displays the new value that i have set.
However, when i have the DCR, the field is an empty element <portal_event_date/>
Date functions are rather lengthy, so I haven't pasted them below.
any ideas?
function setPortalDateField(item) {
var portalDateFound = false;
var itemName = item.getName();
var itemValue = item.getValue();
var parentItemName = itemName.substring(0,itemName.lastIndexOf('/'));
var parentItem = IWDatacapture.getItem(parentItemName);
var arChildren = parentItem.getChildren();
for(var i=0; i<arChildren.length; i++) {
var childName = arChildren
.getName();
childName = childName.substring(childName.lastIndexOf('/'));
if(childName == '/portal_event_date') {
portalDateFound = true;
if(!isDate(itemValue,'M-d-yyyy')) {
alert('You must enter a date in the format M-d-yyyy');
item.setValue(item.oldValue);
}
arChildren
.setValue(formatDate(new Date(item.getValue()),'MMddyyyy'));
alert(arChildren
.getValue());
}
}
if(!portalDateFound) {
alert('This DCR needs to have an portal_event_date field added');
}
}
Find more posts tagged with
Comments
dazzlad
Hi. Please ignore this post.
was an issue with the user's desktop machine.
Thanks
Darren.