bggann
Active Member
I have a database join element that is intended to show a list of Counties in a State based on the selection of the state from another dropdown/database join on that form.
Table structure
"states" - > id, DateTime, state, abbr
where state is the full name of the state and abbr is the 2 letter abbreviation for a state.
Counties -> id, DateTime, county, state
where state is the same as abbr above.
In my form I use database join for "County" with the "data where" filter of
WHERE {thistable}.state = (SELECT abbr from states where id = '{assist_9_repeat___state}')
then "Ajax update" is on - so the database join is updated when the {assist_9_repeat___state} is changed.
90% of the time the "state" will be a particular state (Colorado) - so to make things simpler - "state" , {assist_9_repeat___state}, has a default of "CO" form load.
Flow:
New record.
state is loaded with "CO"
the County dropdown is empty because "state" has not changed, so the AJAX update has not fired.
The user must select some other state, then "CO" again - which fires the AJAX update in the county database join and populates the County dbjoin with Colorado counties.
-> This is the problem. I need to populate the County dropdown with Colorado Counties on load - but ajax only fires it the state dropdown is changed - it does not fire on load.
There is an Ajax default that I can set - but that only returns 1 string for County, it does not populate the county list.
I can get rid of the default for 'State', but I'm 100% sure my users will say "can't you make the default state Colorado - that's what we use all the time".
Thoughts? Maybe a helper run on load for the form that populates the county dropdown?
-----------------
Similarly, on loading of a record to edit, the County is populated, but the, but again the AJAX update is not fired - so if the user needs to change the county, they have to change "state" 2 times, to force the county dbjoin to update.
-----------------
This seems like such an obvious need for AJAX update on dbjoin - what am I missing?
-Bob
Table structure
"states" - > id, DateTime, state, abbr
where state is the full name of the state and abbr is the 2 letter abbreviation for a state.
Counties -> id, DateTime, county, state
where state is the same as abbr above.
In my form I use database join for "County" with the "data where" filter of
WHERE {thistable}.state = (SELECT abbr from states where id = '{assist_9_repeat___state}')
then "Ajax update" is on - so the database join is updated when the {assist_9_repeat___state} is changed.
90% of the time the "state" will be a particular state (Colorado) - so to make things simpler - "state" , {assist_9_repeat___state}, has a default of "CO" form load.
Flow:
New record.
state is loaded with "CO"
the County dropdown is empty because "state" has not changed, so the AJAX update has not fired.
The user must select some other state, then "CO" again - which fires the AJAX update in the county database join and populates the County dbjoin with Colorado counties.
-> This is the problem. I need to populate the County dropdown with Colorado Counties on load - but ajax only fires it the state dropdown is changed - it does not fire on load.
There is an Ajax default that I can set - but that only returns 1 string for County, it does not populate the county list.
I can get rid of the default for 'State', but I'm 100% sure my users will say "can't you make the default state Colorado - that's what we use all the time".
Thoughts? Maybe a helper run on load for the form that populates the county dropdown?
-----------------
Similarly, on loading of a record to edit, the County is populated, but the, but again the AJAX update is not fired - so if the user needs to change the county, they have to change "state" 2 times, to force the county dbjoin to update.
-----------------
This seems like such an obvious need for AJAX update on dbjoin - what am I missing?
-Bob