I am trying to use Chronoforms v8 and recreate a form that worked in v7 and imported to v8. The problem is that after wrestling with the Trigger/Listener events, I have so far managed to get it to work, not on initial form load, but after page refresh. Basically, I have dropdown1 and dropdown2, both with a database datasource.
Expected behaviour: When the user change option in dropdown1, its value is then used to retrieve the option(s) for dropdown2.
Actual behaviour: Initial page loads with empty dropdown1 options. On manual page refresh, dropdown1 is populated. On dropdown1 value change, dropdown2 options remains empty. On subsequent page manual refresh, dropdown2 option is populated. Adding a 'Reload' event duplicates the form on the page (weird behaviour). What am I missing?
Hi amitycol
if dropdown1 options should be available on page load then you need to use the Dynamic Options behavior to specify a data source for the options, or use the static Options list, please try that and let me know
For Dynamic Options you will need a data source variable, either from Read Data OR some PHP code
Max_admin, I did say both dropdown1 and dropdown2, use database as datasource. Meaning they both use the Dynamic Options behavior to specify a data source.
Then when the page loads the options should be already there unless there is something wrong
Please post a screenshot of how you setup the dropdown1
Please find the attached. It appears the events are not responding directly to user actions. I have disabled all cache extensions/plugins including Joomla cache, just to be sure it is not a caching issue.
It's not caching, the configuration is wrong, you do NOT need any Events Triggers or Listeners here, you just need Dynamic Options with Read Data, this is the tutorial you should follow:
After removing the Event Listener and Trigger for the Read_Data (read_data47), the problem is still occurring (I think that is why I ended up adding the event trigger and listener). Anyway, I removed them and still experiencing the same issue. The option is not populated on page load until a hard page refresh.
I thought it may have something to do with the SQL statement in the WHERE clause of the Read_Data (see screenshot) so I created a new form with just one dropdown and a read_data with the same datasource but no WHERE clause, and it also has the same problem.
The dropdown now loads the values when the page loads. I had to move the read_data47 to the top of the page before all other elements. Changing the dropdown value still does not trigger the populating of the second dropdown as expected until the page is refreshed. Possibly a javascript/jquery issue.
Yes, the Read Data should be ABOVE the Dropdown using it
if you need the second dropdown to load values based on selections in dropdown1 then this is where you need the Events Triggers/Listeners, here is the tutorial for that:
You will need to use the on Value Changes event
