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)
Form API
SMB
I'm using Form API to dynamically display fields in the DCT based on user selections in other fields. This is working fine. The problem is that I also have a textarea with a VFE. When the users selects a field that dynamically displays other fields, the content in the VFE is deleted when the form is redrawn. Any suggestions?
Find more posts tagged with
Comments
netsnaveen
Hello,
I have two list boxes of which I need to populate based on selection of the first one. My env is Solaris TS 5.5.2. Havent been able to do using FormAPI. I understand U have got it.
Can You please share me the way to achieve it or if you can share the code the better.
Thanks,
Naveen.
264.pdf
SMB
Attached is the code you requested. This works fine for us. The problem is that we have a textarea with a Visual Format Editor. When the DCR reloads based on the RegionState selection, the Visual Format Editor also reloads and we loose the text.
Our environment is TS 5.5.2 on Windows2000.
Hope this helps.
Here’s the code from the DCR.
Javascript:
<script language=”javascript” location=”template-type” src=”email.js”/>
Input Fields:
<item name=”RegionState”>
<label> <![CDATA[<b>State or Region</b>]]> </label>
<radio>
<option value=”all” label=”All States and Regions”
selected=”t”/>
<option value=”states” label=”Select States”/>
<option value=”regions” label=”Select Regions”/>
</radio>
</item>
<container name=”Regions”>
<label></label>
<item name=”Region”>
<label>Select Regions</label>
<checkbox multiple=”t”>
<option value=”western” label=”Western”/>
<option value=”central” label=”Central”/>
<option value=”eastern” label=”Eastern”/>
</checkbox>
</item>
</container>
<container name=”States”>
<label></label>
<item name=”State”>
<label>Western States</label>
<checkbox multiple=”t” wrap=’virtual’>
<option value=”AZ” label=”AZ”/>
<option value=”CA” label=”CA”/>
<option value=”CO” label=”CO”/>
<option value=”KS” label=”KS”/>
<option value=”NV” label=”NV”/>
<option value=”NM” label=”NM”/>
<option value=”OK” label=”OK”/>
<option value=”OR” label=”OR”/>
<option value=”TX” label=”TX”/>
<option value=”UT” label=”UT”/>
<option value=”WA” label=”WA”/>
</checkbox>
</item>
<item name=”State1”>
<label>Central States</label>
<checkbox multiple=”t”>
<option value=”AL” label=”AL”/>
<option value=”AR” label=”AR”/>
<option value=”FL” label=”FL”/>
<option value=”GA” label=”GA”/>
<option value=”IL” label=”IL”/>
<option value=”IN” label=”IN”/>
<option value=”IA” label=”IA”/>
<option value=”KY” label=”KY”/>
<option value=”LA” label=”LA”/>
<option value=”MI” label=”MI”/>
<option value=”MN” label=”MN”/>
<option value=”MO” label=”MO”/>
<option value=”NC” label=”NC”/>
<option value=”OH” label=”OH”/>
<option value=”SC” label=”SC”/>
<option value=”TN” label=”TN”/>
<option value=”WI” label=”WI”/>
</checkbox>
</item>
<item name=”State2”>
<label>Eastern States</label>
<checkbox multiple=”t”>
<option value=”CT” label=”CT”/>
<option value=”DE” label=”DE”/>
<option value=”DC” label=”DC”/>
<option value=”ME” label=”ME”/>
<option value=”MD” label=”MD”/>
<option value=”MA” label=”MA”/>
<option value=”NH” label=”NH”/>
<option value=”NJ” label=”NJ”/>
<option value=”NY” label=”NY”/>
<option value=”PA” label=”PA”/>
<option value=”RI” label=”RI”/>
<option value=”VT” label=”VT”/>
<option value=”VA” label=”VA”/>
<option value=”WV” label=”WV”/>
</checkbox>
</item>
</container>
Here’s the javascript:
function init()
{
IWEventRegistry.addItemHandler(“/RegionState”,
“onItemChange”, onRegionStateChange); onRegionStateChange(IWDatacapture.getItem(“/RegionState”));
}
function onRegionStateChange(item)
{
var flag = item.getOptions()[item.getValue()].value == “all”;
IWDatacapture.getItem(“/States”).setReadOnly(flag);
IWDatacapture.getItem(“/Regions”).setReadOnly(flag);
IWDatacapture.redraw();
var flag = item.getOptions()[item.getValue()].value == “states”;
IWDatacapture.getItem(“/States”).setVisible(flag);
IWDatacapture.getItem(“/Regions”).setReadOnly(flag);
IWDatacapture.redraw();
var flag = item.getOptions()[item.getValue()].value == “regions”;
IWDatacapture.getItem(“/States”).setReadOnly(flag);
IWDatacapture.getItem(“/Regions”).setVisible(flag);
IWDatacapture.redraw();
}
init();
pflory
Naveen,
There is a sample DCT and javascript that ships with Templating that does what you are seeking.
On my machine it lives at:
C:\iw-home\examples\Templating\templatedata\userscript\location\datacapture.cfg
(your's should reside in a similar location)
This example makes use of a CGI/Perl script "getLocations.ipl". See the respective README file for further details about how to put this example into orbit.
Paul
Paul Flory
netsnaveen
Hi Paul,
Thanks for all your help. I got it to work. I had seen the example getlocations.ipl some time ago. Still was not able to get what I wanted.
What I realised (dont know wrong or right!!) is that stopping the iwserver and starting it would not necessarily enable FormAPI features. I had not done iwreset -ui.. After that things are now working fine.
But then thats not the end U know.. Its just the beginning -
Like putting the machine on Mars is just the beginning of finding life elsewhere.
Migrateduser
You are correct that stopping and starting iwserver will not have any effect on the FormAPI capabilities. iwreset -ui is the right call to reset the FormAPI capabilities. regards,
lissa