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)
Visual format + Formapi + cgi-callout question
wngg2
Hello,
I got a Visual format + Formapi + cgi-callout question.
Scenario:
3 items - visual format, textarea, callout button
Task - use callout (perl script) to active the visual format window, when I click "ok" on the cgi form, data will be set on the textarea. However, the textarea will be invisible to clients.
Problem:
If I apply the <hidden> tag or use the setVisiibility(false) method from formapi, it will hide the button also. Therefore, I seperate the button and the textarea into two items and then hide the textarea item. Furthermore, in the cgi callout script I hard-coded the form value for the textarea as follow:
#my $element_name = $cgi->{'form'}{'iw_callback_var'};
my $element_name = "test/AGS_Full_Text"; #<---name of the form field
Result:
It worked when I didn't set the "visibility = true" (formapi) on the textarea, but it failed when I did so.
What bothers me was that I could use an inline script to pre-populate a form field that is not visible (by formapi, not the <hidden> tag), but I couldn't use a cgi-callout script to achieve the same goal. Does anyone know how to do that?
Thousand thanks!!
Find more posts tagged with
Comments
wngg2
Guys,
I found out that there is no way I can use a cgi script to populate the "invisible" textarea because when I did the "view source" on the DCT, the HTML code for the textarea is not there (which make a lot of sense).
However, is there another way to do that?
Thanks
Gregg Faus
I haven't found a way. Just yesterday I tried populating a hidden field with a value. I'm beginning to think what the purpose of a hidden field is if you cannot call an inline command to populate it.
I then tried hiding the field with FormAPI, but then noticed that if you hide the field it doesn't get saved in the DCR.
If I missing something I'd be happy to see some code that works for the two situations listed above.
output.pdf
repeaterSample.dcpackage
Migrateduser
When you set visible to false on an item and redraw the form, this item does not render any HTML.
There is still a way for your CGI callout to set the value on that item, even if it is invisible. However, you won't be able to set it directly on the form; rather, you would set it through the FormAPI. Here is an example javascript (in the callout) using the getScriptFrame() method in Form API to do this:
var scriptFrame = opener.parent.getScriptFrame();
var item = scriptFrame.IWDatacapture.getItem("/test/AGS_Full_Text");
item.setValue("It was a dark and stormy night...");
...
--Daniel
techSan
Thanks Daniel, that was pretty useful, it helped in what I needed to do!!!