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)
FormAPI-Dropdown
System
Hi,
I want to clear the value and label of drop down using formapi.
I am getting value using the below statement
var index = IWDatacapture.getItem("/ProductCategories").getValue();
var option = IWDatacapture.getItem("/ProductCategories").getOptions();
option[index].value it will return value. But i want to do some things like this
option[index].value = '';
option[index].label='';
Any suggestion ??
Thanx in advance
Find more posts tagged with
Comments
JonathonG
After changing the options array, you need to re-set the options on the datacapture form:
IWDatacapture.getItem("/ProductCategories").setOptions(option);
Jonathon
Interwoven Architecture Consultant
Migrateduser
Thanx for your reply
i used
IWDatacapture.getItem("/ProductCategories").setOptions(option);
Still it is not clearing the drop down?
Thanx in advance
JonathonG
Hmm, you made need an IWDatacapture.redraw after doing a setOptions. I can't remember for sure...
I'm assuming you called setOptions after making the other changes to the options array.
Jonathon
Interwoven Architecture Consultant
Migrateduser
Thanx for your reply
I am using the below code. Still i am not able to clear dropdown.
var index = IWDatacapture.getItem("/ProductCategories").getValue();
var option = IWDatacapture.getItem("/ProductCategories").getOptions();
alert(option[index].value);
option[index].value='';
option[index].label='';
IWDatacapture.getItem("/ProductCategories").setOptions('');
IWDatacapture.redraw();
May be iam doing some thing wroing in above code
Thanx in advance
bkret
Use this instead, of course within a for loop. One thing make sure the val of num is a number.
IWDatacapture.getItem("/optionItemName").removeOption(parseInt(num) );
Brandon Krett
Team Lead
Allstate Inc
Migrateduser
Thanx for your reply. It is working now with removeOptions()
JonathonG
Glad it's working for you...the problem with your other code was this line:
IWDatacapture.getItem("/ProductCategories").setOptions('');
It should read:
IWDatacapture.getItem("/ProductCategories").setOptions(option);
Of course, that won't take the option out of the select list, it will just create a blank option.
Jonathon
Interwoven Architecture Consultant
Migrateduser
Thanx for your reply on this.
In the below code i am trying to display the label ??
i am getting the value with option[index].value
when i am trying for label in similar way it is giving undefined
option[index].label ???
var index = IWDatacapture.getItem("/ProductCategories").getValue();
var option = IWDatacapture.getItem("/ProductCategories").getOptions();
alert(option[index].value);
alert(option[index].label); --> it is displaying undefined
Thanx in advance
Edited by krishna1288 on 08/08/03 02:33 PM (server time).
hemranga
Hi,
alert(option[index].label);
doesnt work.........
It has to be alert(option[index].text.
The label can be accessed through text property.
Try this
Hemanth