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)
Issue in making a dcr field read only in formAPI
xyz1
Hi,
I am trying to make a selection dropdown read only (in TS 6.7).
I make it not read only first and select the items that I need in it according to the selection of another drop down and making it readonly again.
It is displayed in grey, but I am able to change the selection. It is not changing to read only. Any help would be appreciated.
Here is the method.
function setState(item)
{
var regionItem = IWDatacapture.getItem("/REGION");
var region = regionItem.getOptions()[regionItem.getValue()].value;
var BLSstates = new Array('AL', 'FL', 'GA', 'KY', 'LA', 'MS', 'NC', 'SC', 'TN');
IWDatacapture.getItem("/STATE").setReadOnly(false);
//alert("region: " + region);
var stateOptions = IWDatacapture.getItem("/STATE").getOptions();
//since BLS was added in the REgion dropdown, the states drop down needs to be editable.
if (region == "XYZ")
{
//deselect all the items
for(var i=0;i<=49;i++)
{
stateOptions
.selected = false;
}
IWDatacapture.getItem("/STATE").setOptions(stateOptions);
//select SBC states
for(var i=0;i<=12;i++)
{
stateOptions
.selected = true;
}
IWDatacapture.getItem("/STATE").setOptions(stateOptions);
//make editable for SWB pages
if (IWDatacapture.getItem("/DCT_CATEGORY").getValue() != "SWB_Content/general")
{
IWDatacapture.getItem("/STATE").setReadOnly(true);
alert("state is read only");
}
else
{
IWDatacapture.getItem("/STATE").setReadOnly(false);
alert("state is not read only");
}
}
else if (region == "ABC")
{
//deselect all the items
for(var i=0;i<=49;i++)
{
stateOptions
.selected = false;
}
IWDatacapture.getItem("/STATE").setOptions(stateOptions);
//select BLS states
for(var i=0;i<=49;i++)
{
for(var j=0;j<=BLSstates.length-1;j++)
{
if (stateOptions
.value == BLSstates)
stateOptions
.selected = true;
}
}
IWDatacapture.getItem("/STATE").setOptions(stateOptions);
IWDatacapture.getItem("/STATE").setReadOnly(true);
alert("state is read only");
}
IWDatacapture.redraw();
}
Find more posts tagged with
Comments
Adam Stoller
Are the alert's showing up in both cases?
If not - it is an indication that something is wrong in your FormAPI code such that Javascript stopped being processed.
serialbygroup .rptdesign
xyz1
Yes. the alert is showing up in both cases correctly.