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)
radio button
elikesha
hi all,
I'm really new to the TeamSite .
I want to add radio button to enable and disable fields in the data capture template. Initially fields are disable and if radio button selected and appropriate
fields will be enable
Thanks
Find more posts tagged with
Comments
Lozza
Hi,
It's a little unclear, but it sounds like you need FormAPI. You'll find documentation on your TeamSite server, at
http://YOUR_SERVER/iw/help/tst/formapi/
, or as a PDF on the support site (tst.****.formapi.pdf).
You'll need to read it pretty throroughly to work out what the **** is going on, but in particular look at 2.4 (Events) and 2.5 (Visibility and Read-Only).
Also, check your Templating documentation (tst.****.dev.pdf) for the <readonly> element, which you can use to set datacapture items as being initially disabled.
Cheers, hope that gets you started.
Loz
Nidhi_Agrawal
Use FormApi for that on DCT
I am giving a dummy code for that.
<script>
function init()
{
IWDatacapture.getItem( "/End_Date" ).setVisible(false);
IWDatacapture.getItem( "/Start_Date" ).setVisible(false);
IWEventRegistry.addItemHandler("/radioButtonItemName","onItemChange",test);
}
function test()
{
if ( IWDatacapture.getItem( "/radioButtonItemName" ).getValue() == "yes" )
{
IWDatacapture.getItem( "/Start_Date" ).setVisible(true);
}
else
{
IWDatacapture.getItem( "/End_Date" ).setVisible(true);
}
}
IWEventRegistry.addFormHandler("onFormInit", init);
</script>
kaalraa
Hi Elikesha,
As per your query it is very much known about your entry into Teamsite world. Welcome.
Some points to remember once writing any issue on Devnet.
1. First provide the details as on what platform you are? Which version of teamsite is being used?
2. Queries to be put up under appropriate topics. As this is related to TeamSite FormsPublisher (Templating) .
~ aks
TestReport.rptdesign
elikesha
please can you check wether this is ok . what are the errors.
I put this code under .js file and include that in the datacapture.cfg
<script>
function init()
{
IWDatacapture.getItem( "/short_des" ).setVisible(false);
IWDatacapture.getItem( "/link_name" ).setVisible(false);
IWDatacapture.getItem( "/link_path" ).setVisible(false);
IWDatacapture.getItem( "/link_tooltip" ).setVisible(false);
IWDatacapture.getItem( "/article" ).setVisible(false);
IWEventRegistry.addItemHandler("/Index","onItemChange",test);
IWEventRegistry.addItemHandler("/Link","onItemChange",test);
IWEventRegistry.addItemHandler("/Article","onItemChange",test);
}
function test()
{
if ( IWDatacapture.getItem( "/Index" ).getValue() == "yes" )
{
IWDatacapture.getItem( "/short_des" ).setVisible(true);
}
else if ( IWDataCapture.getItem("/Link").getvalue()=="yes")
{
IWDatacapture.getItem( "/link_name" ).setVisible(true);
IWDatacapture.getItem( "/link_path" ).setVisible(true);
IWDatacapture.getItem( "/link_tooltip" ).setVisible(true);
}
else
{
IWDatacapture.getItem( "/article" ).setVisible(true);
}
}
IWEventRegistry.addFormHandler("onFormInit", init); </script>
kaalraa
Look like OK... but you have to test it on your environment. If still found any error just write back with the error you got. Learning from your errors make you more confident rather asking away to debug your code.
Thanks,
~ aks
Nidhi_Agrawal
Remove "<script>" from ur js file and also attach DCT if u find this not working.
Nidhi
elikesha
Currently I'm not getting any error or any result,
I'm wonder that i place the code correctly.
I create hide.js file with that code and add the following line to the datacapture.cfg
<script language="javascript" location="template-type" src="hide.js">
should I required to do any modifications to the template6.0.dtd
Nidhi_Agrawal
your js is calling from dct or not??
where u have put the js file??
Nidhi..
kaalraa
In src provide the complete path where your js file is residing. Also remove the location attribute. Also as Nidhi has said.... in js file there should be no script tag in the js file.
Also if this does not work, just copy your code from js file and paste it directly with in the DCT as following:
<data-capture-requirements....... >
<ruleset.. >
<script>
<![CDATA[
---- your js code is to be here pasted----
]]>
</script>
<item....>
.....
~ aks
jbonifaci
Also, you can throw an alert at the top of your js file to see if it is being found.
~Jeff
elikesha
Hi,
I can access fields in the root container using following, my root container is "about_index"
IWDatacapture.getItem( "/about_index/title" ).setVisible(false)
I have a another container ( " about_index_list) under root container. how can I access to fields in the about_index_list container
Thanks & Regards
Shanaka
Nidhi_Agrawal
Hi Shanaka,
The way of accessing the subitem of root-container is same
var item=IWDatacapture.getItem( "/about_index/about_index_list/sub_container_itam" );
Shanaka read FormApi pdf for more clearity.
Nidhi..
kaalraa
Shanaka,
Its all to be done in same way. Earlier you are accessing fields directly under root container. Now there is one more container.
IWDatacapture.getItem( "/about_index/
about_index_list
/title" ).setVisible(false).
Just go along with the concept as per the heirarchy and path of fields.
~ aks
elikesha
ohhhhhhhhhhh,
I dont know why , thats not working , please help me.
but ok with root container , IWDatacapture.getItem( "/about_index/title" ).setVisible(false);
IWDatacapture.getItem( "/about_index/about_index_list/title" ).setVisible(false); this one not working
thanks,
Shanaka
kaalraa
Please confirm.... are you following the correct pat as per heirarchy? Just make sure... if the container is a sub-container of the name you are providing in your path OR else if it is a separate container then path would differ.
Still if you have any doubt just attach your DCT and Js file.
~ aks
elikesha
Thanks
my datacapture.cfg
<!DOCTYPE data-capture-requirements SYSTEM "datacapture6.0.dtd">
<data-capture-requirements name="about_index">
<ruleset name="about_index">
<label>About Index</label>
<description>About Index</description>
<script language="javascript" location="template-type" src="employee.js"></script>
<root-container location="about_index" name="about_index">
<container name="about_index_list" max="100" min="1" default="1" location="about_index_list">
<label>Index List</label>
<description>about</description>
<item name="title" pathid="title" >
<label>Title</label>
<description>Title</description>
<text />
</item>
<item name="page_name" pathid="page_name" >
<label>Page Name</label>
<description></description>
<text />
</item>
<item name="short_des" pathid="short_des" >
<label>Short Description</label>
<description>Short Description Under Heading</description>
<textarea />
</item>
<item name="parent" pathid="parent" >
<label>Parent</label>
<description>Parent of the current link</description>
<text />
</item>
<item name="radio_button" pathid="radio_button" >
<label>Type</label>
<description>Check the box If Link is External</description>
<radio>
<option name="Index" label="Index"/>
<option name="Article" label="Article"/>
<option name="Link" label="Link"/>
</radio>
</item>
<item name="link_name" pathid="link_name" >
<label>Link Name</label>
<description>Related Link Name</description>
<text />
</item>
<item name="link_path" pathid="link_path" >
<label>Link Path</label>
<description>Link Path.</description>
<text />
</item>
<item name="link_tooltip" pathid="link_tooltip" >
<label>Link Tooltip</label>
<description>Tooltip</description>
<text />
</item>
<item name="article" pathid="article" >
<label>Article</label>
<description>Article body</description>
<textarea rows="40" cols="80" external-editor="visualformat"/>
</item>
</container>
</root-container>
</ruleset>
</data-capture-requirements>
employee.js
function init()
{
IWDatacapture.getItem( "/about_index/about_index_list.short_des" ).setVisible(false);
//IWDatacapture.getItem( "/about_index_list/title" ).setVisible(false);
//IWEventRegistry.addItemHandler("/radioButtonItemName","onItemChange",x);
}
function x(){}
function test()
{
if ( IWDatacapture.getItem( "/radioButtonItemName" ).getValue() == "yes" )
{
IWDatacapture.getItem( "/Start_Date" ).setVisible(true);
}
else
{
IWDatacapture.getItem( "/End_Date" ).setVisible(true);
}
}
IWEventRegistry.addFormHandler("onFormInit", init);
Nidhi_Agrawal
IWDatacapture.getItem( "/about_index/about_index_list.short_des" ).setVisible(false);
will not work .
Use this
IWDatacapture.getItem( "/about_index/about_index_list/short_des" ).setVisible(false);
Nidhi..
elikesha
I used that one . but still not working . should I do any modifications to the templating.dtd
jbonifaci
The problem is, about_index_list is a replicant. You can not hide every instance of short_des with one call. You must iterate through each replicant and hide the short_des field within. For example, the following will hide short_des in the first about_index_list replicant:
IWDatacapture.getItem("/about_index/about_index_list
[1]
/short_des").setVisible(false);
~Jeff