This topic is locked

Using dependent dropdowns when data is inserted into the dependent field, rather than selected

4/13/2023 5:53:39 AM
PHPRunner General questions
P
pmuckle authorDevClub member

Hi All,
I now have a button to insert some data from the previous record.
But there is a problem because the data is being inserted into a dependent field (Owner) for the following dropdown (Name), and the query is not updated so no records show:
img alt
This shows the add form before data is entered. Project and Town dropdowns are populated from the previous record by default, and the dependencies work.
If the record is paired with the last record using the button, the lat long and Owner data is inserted, as below.
img alt
Now I need to select the Name from a list linked to the Owner, but the list has not been initialised:
img alt
If I de-select and re-select the Owner, the list of names appears below.
My question is, how can I update the Names dropdown (dependent on Owner) using inserted data, without having to de/re-select?
Thanks for any help
Pete

W
wedi 4/13/2023

In "After Client" of your Button to insert "previous values" try the following:
`var locid = Runner.getControl(pageid, "locationID");
locid.setValue(result["locationID"]);

var ownid = Runner.getControl(pageid, "ownerID");
if the values in dropdown owner depends on location then add:
ownid.reload({});

ownid.setValue(result["ownerID"]);

Also do it with Name:
var namefield = Runner.getControl(pageid, "name");
namefield.reload({});`Hope it helps.
wedi

P
pmuckle authorDevClub member 4/15/2023

Thanks again Wedi, that has worked great
Pete