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)
FormAPI and multiple CallServer-Commands
hasel
Hi!
I have two CGI Scripts which fill two different DropDown Lists. They are called with two IWDatacapture.callServer-Statements. The first is always executed but the second will never be called. If I comment the first statement the second runs properly, so it is no error in this script. Now I have tried it with a window.setTimeout with no effect.
The reason why I use two CGI-Scripts is, I want to reuse this scripts in other DCTs.
What can I do to execute both?
Thx for your help.
Hasel
Find more posts tagged with
Comments
Migrateduser
The problem is that callServer is synchronous, so if you call it again before the first CGI finishes, the results of the first CGI are never executed.
There are at least two ways to deal with this. I prefer to change the code from having the CGI generate JavaScript to having the CGI generate XML, then creating a synchronous instance of the browser's XML object loaded from that CGI XML (NOT using callserver). Then all the code is in the FormAPI scripts rather than the CGI scripts, which makes maintenancen and debug a lot easier. Another option is to pass a "trigger" to the first CGI (telling it what function to invoke when that FormAPI completes). This gets pretty hairy in complex applications so I highly recommend the XML option, but IE and Mozilla process XML differently (hopefully you can limit your CMS clients to a specific browser/version to make QA of your FormAPI easier anyway).
Jens
Hi Hasel,
what you can do is to call another function at the end of your first CGI which is located in your FORMAPI-Script and there you do the 2nd callserver.
Ex:
1st CGI:
<html>
<head>
<script language="javascript">
<!--
var ID = "$id";
// -->
</script>
</head>
<body onload="parent.getScriptFrame().callbackID(ID)">get Sequence-ID</body>
</html>
FormAPI.js:
function callbackID(ID) {
DO WHATEVER YOU WANT
LIKE callserver(....)
}
Ciao,
Jens
hasel
thanks it works fine.
Adam Stoller
The problem is that callServer is synchronous,
No - it's
a
sychronous - a lot of things would be much simpler if it were synchronous.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
Migrateduser
Sorry about that. I'm moving to marketing.