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 problem
madmax
first time i can save with no problem. but after save if i press finished then following scrub function goes forever. it keeps reading topLevel = IWDatacapture.getRootItems(); and goes forever. any suggestions?
*****************************************************************************************
function init() {
var holdStr="startvalue";
IWEventRegistry.addFormHandler("onSave",scrub);
}
function scrub()
{
var i;
var j = 0;
var topLevel;
topLevel = IWDatacapture.getRootItems();
for(i = 0; i< topLevel.length; i++)
{
if (topLevel
.isVisualFormat ())
{
var vfItemx = new Array;
vfItemx = topLevel
.getName();
var vfField = vfItemx;
if (vfField == "/salesCopy" || vfField == "/introText")
{
scrubText(vfField);
}
else
{
scrubBody(vfField);
}
j++;
}
}
return true;
}
********************************************************************************************
Find more posts tagged with
Comments
Adam Stoller
It might make things a bit clearer if you post again - but this time change the drop-down choice directly above the area where you paste your code from
using Markup
to either
using HTML
or
without Markup/HTML
-- The "markup" tags use
like HTML uses
<i>
and therefore removes those three characters and starts italicizing everything after it -- which, especially in the case of javascript code where people have a tendency to use the letter '
i
' for indexes into arrays (
as you did
) - has a tendency to make the code less than clear.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
jbonifaci
Can you post your entire js as an attachment? That might be easier.
Now, you said it keeps reading toplevel = IWDatacapture.getRootItems(). What exactly do you mean by this? If you put an alert before and after that line, does only the first alert fire and then the javascript hangs on that line? Or do you mean that your for loop goes forever?
If it is the latter, shot in the dark here. Do either of your scrubText or scrubBody functions use i? If they are modifying the value of i, your loop might never exit.
Also, if it is the for loop, have you tried putting an alert at the beginning:
alert('i: ' + i + '\ntoplevel.length: ' + toplevel.length);
This might help give you a clue what is going on.
madmax
this is a global js file which scrub html tag from vf textarea from any dct according to their field name. it works but if i press save 2 times consequetively then vfScrub goes into a infinite loop.
and what it should do is when it has done looping through all the field in the dct then it should return true and get out of the vfScrub functions. i am attaching my vfScrub.js file. if anybody can point me why it is going for infinte loop , i'll be thankful.
thanks.
madmax
sorry here is the attach file.
Migrateduser
It might also help to register the event to onSaveValid instead of just onSave.
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP2 on W2K
(3) TS 6.1 on W2K
madmax
onSaveValid doesn't do anything.
Migrateduser
Hmm, sorry about that then... I see your attached code -- what do the alerts tell you? Where is it getting caught?
Dave
Current Environment(s):
(1) TS 6.1 SP1 on W2K3
(2) TS 6.1 SP2 on W2K
(3) TS 6.1 on W2K