Search code examples
google-app-maker

Update 2 fields onValueChange?


I have a dropdown @status with a "Done" and "Pending" options. When one of those options is selected I would also like to update a different field called @type with the value "Set".

Could I do this under @status drop-down with some custom action onValueChange or is there a better way to do this?

Thanks.


Solution

  • Yes, you can do it on the onValueChange event handler, although I would recommend to do it instead on the onValueEdit event handler, unless you are planning to programatically change the value of the dropdown, then you better stick with the onValueChange. Here is what you need to do:

    widget.datasource.item.type = "Set";
    

    Reference: https://developers.google.com/appmaker/scripting/api/client#Record