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)
Replicant and FormAPI problem
JackIntheBox
I am having trouble with a javascript method involving replicants and FormAPI. I am using TeamSite 5.5.2 on Solaris.
Basically, the problem involves performing manipulations while saving a replicant field. I am unable to get the javascript code to compile past "alert(3)". Can someone please figure out what is wrong?? I have also enclosed my datacapture.cfg as an attachment.
function prepopulateDates( button )
{
date1 = new Date(2003,1,11,05,06,07);
date2 = new Date(2003,2,11,05,06,07);
alert( "1" );
var Promotions = new Array();
alert( "2" );
var PromotionItem = IWDatacapture.getItem("/RegularPromotions");
alert( "3" );
Promotions = PromotionItem.getChildren();
alert( "4" );
for (j=0;i<Promotions.length;j++)
{
var childItem = Promotions;
var itemName = childItem.getName();
IWDatacapture.getItem( itemName + "/EffectiveDate" ).setValue( getRegexDate( 0 ));
// more code here -- but I am unable to get this far!!!
Thanks in advance!!
Find more posts tagged with
Comments
JackIntheBox
Any ideas?? I am still awaiting
Thanks!!
Smeeta
On line
Promotions = PromotionItem.getChildren();
you need to declare promotions. so I guess the line should read as
var Promotions = PromotionItem.getChildren();
On Line
IWDatacapture.getItem( itemName + "/EffectiveDate" ).setValue( getRegexDate( 0 ));
This line should read as
var effectiveDateItem = IWDatacapture.getItem( itemName + "/EffectiveDate" );
effectiveDateItem.setValue( getRegexDate( 0 )); (Although I am not sure what you are trying to do here. I can see that you are trying to set a value. I am just not sure what getRegexDate( 0 ) does.
Hope this helps
Edited by Smeeta on 02/10/03 12:34 PM (server time).
JackIntheBox
Thanks for your reply, Smeeta. I have added your suggestions and even modified my code to parse the dates in the crudest manner, but still I am unable to load the child Xpaths into the array. Basically the code fails after alert '3' . I am really at a loss!!
function setModifiedBy()
{
alert( "1" );
var Promotions = new Array();
alert( "2" );
var PromotionItem = IWDatacapture.getItem("/RegularPromotions");
alert( "3" );
var Promotions = PromotionItem.getChildren();
alert( "4" );
for (j=0;j<Promotions.length;j++)
{
var childItem = Promotions;
var itemName = childItem.getName();
var regEffDate = IWDatacapture.getItem( itemName + "/EffectiveDate" ).getValue();
var regEndDate = IWDatacapture.getItem( itemName + "/EndDate" ).getValue();
var regeffdate1month = regEffDate.substring(0,2);
var regeffdate1day = regEffDate.substring(3,5);
var regeffdate1year = regEffDate.substring(6,10);
alert( "5 " );
var regenddate1month = regEndDate.substring(0,2);
var regenddate1day = regEndDate.substring(3,5);
var regenddate1year = regEndDate.substring(6,10);
regdate1 = new Date(regeffdate1year,regeffdate1month,regeffdate1day);
regdate2 = new Date(regenddate1year,regenddate1month,regenddate1day);
alert( "6" );
var regdate3 = regdate1.valueOf();
var regdate4 = regdate2.valueOf();
if ( regdate3 >= regdate4 )
{
alert( "Regular Promotions cannot begin after the end date !!" );
return( false );
}
}
var item = IWDatacapture.getItem("/Modified");
item.setValue(IWDatacapture.getUser());
item.setVisible(true);
item.setReadOnly(true);
IWDatacapture.redraw();
// alert( "datecheck working dude!! " + month + " " + day + " " + year );
return( true );
}