John
John

Reputation: 17

Google App Maker - autofill textbox depending on dropdown selected option from an external database

What I'm currently doing is that on the Property Editor of my dropdown widget, on the Event Section using the onValueEdit function, I'm trying to create a custom action script which will give a value to my textbox (using widget.root.descendants.NameOfMyTextbox.value) depending on the selected value of my dropdown.

The values of my dropdown are the IDs stored in my MySql database table Process, for example: ID = 1, name = Assembly, manager = George. For the textbox, I would like to get another table field value depending on the selected value of my dropdown through a select statement (like getting the manager value). What kind of app maker queries or functions should be useful in this case?

Upvotes: 1

Views: 242

Answers (1)

Markus Malessa
Markus Malessa

Reputation: 1831

If your dropdown option binding is @datasources.Process.items then your onValueEdit event simply needs to be:

widget.root.descendants.NameOfMyTextbox.value = newValue.manager;

This would be the only way to set this up however, because this way the options are pointing to your entire record in the Process table and upon selection you can get any other field from that record using newValue.YourField.

Upvotes: 1

Related Questions