Forum Discussion

jeff_stroh's avatar
jeff_stroh
Creator II
5 years ago
Solved

How to change a form dropdown list selection using a method

I've got a form with a few dropdowns that are associated to static lists.  I need to drive the selection of the dropdowns to update based upon a graphic that's made of multiple HTML fields (basically...
  • angela's avatar
    angela
    5 years ago

    I took the first best code sample that I thought it could fit. :-)

    I made a quick test with a custom button in the Part Form to set the make_buy dropdown:

    This one can set a dropdown value on button click. But it´s only a visual setting. The value is not stored in the item.

    var dropdownComponent = getFieldComponentByName("make_buy");
    dropdownComponent.component.setState({
    value: 'Make'
    });


    This variant did the best job. It updates the Form and ensures the correct label is stored:

    window.handleItemChange("make_buy", "Make");

    You can call this one also from custom html elements. So calling this one from a custom grid / table cells should work.