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)
Using another DCRs value for dropdown in FormAPI
Sharon
Does anyone have code to share that would allow a FormAPI template to parse another DCR's item to get the values to present in a drop down list? And if so, on a change, how do you keep the original selected values within the FormAPI template and present all of the other DCR's item values?
Find more posts tagged with
Comments
Migrateduser
If you do this with an inline, I think the inline should populate a Javascript object with all of the data, then your onchange can just use that cached object. I have seen problems with inline generating FormAPI code (IE5.5 I think), and in general I think it's best to avoid inline. If all of your users are IE5.5/IE6 or Mozilla 1.7 (and possibly some other browsers), then you can use the XML parser available to the browser to load the XML of the other DCR. I have code that does this for IE but I never tried it with Mozilla (in general I think it's best to restrict CMS client browsers to avoid the need to cross-browser test templates as well as reducing support costs). You could also use callServer, but since that's asynchronous it can cause problems. Another way would be a callout, but I can't tell if/how this would apply based on the problem staement.
Dwayne
If I understand your question correctly (and I'm actually not all that certain that I do), then I wouldn't use FormAPI at all. If you need the contents of a DCR to drive a dropdown list in another DCT, then I'd probably use an <inline> callout, rather than FormAPI, as I think it will result in a quicker response time for the user (less network traffic). Unless the user is going to be browsing for the DCR to reference, and choosing that DCR causes the contents of the dropdown to change dynamically.
--
Current project: TS 5.5.2/6.1 W2K
Migrateduser
I've never done this with FormAPI, but I have done this a few years back using an inline. The inline too the vpath (relative to the workarea) as a parameter and used TeamSite::XMLparser to read the other DCR and return a options list. I don't have the code handy, but, as you can imagine, it only takes a dozen lines of code or so.