0

When I select other from drop down menu, I need to display a text box. Can you guys tell me how to achieve it?

This in my Team Site dct file:

<item name="Body.subHeading" pathid="Body.subHeading">
    <description>Body</description>
    <label>Body</label>
    <select required="t" size="1">
        <option label="Dimensions" value="en_AU"/>
        <option label="Weight" value="en_UK"/>
        <option label="Batter" value="en_US"/>
        <option label="Other" value="en_US"/>
    </select>
</item>
Drewness
  • 5,004
  • 4
  • 32
  • 50

1 Answers1

1

You can do that using JavaScript in the DCT. Try accessing your item in JavaScript and check its value, if its Other then set the visibility of text box to true.

Eg:

function handle_c_changed() {
    var textBoxItem =  IWDatacapture.getItem(path_of_text_box);
    var dropdown = IWDatacapture.getItem(path_of_drop_down);
    var item = dropdown.getOptions()[dropdown.getValue()].text;
   if (item == 'Other'){ 
      textBoxItem.setVisible(true);
   }
 }
IWEventRegistry.addFormHandler(path_of_drop_down,"onItemChange", handle_c_changed);