We have a form with a few dynamic dropdown fields. Upon selecting "Dropdown 1" field, "Dropodown 2" field is reloaded with new options.
We now want to edit a row on the database, so we retrieve it into a form. We can load the Selected values into "Dropdown 1" from the database row. However, as the option in "Dropdown 1" is not selected on load, "Dropdown 2" value cannot be pre-selected with value from database on load.
Hope we made the question clear! Thanks for your help in advance.
We now want to edit a row on the database, so we retrieve it into a form. We can load the Selected values into "Dropdown 1" from the database row. However, as the option in "Dropdown 1" is not selected on load, "Dropdown 2" value cannot be pre-selected with value from database on load.
Hope we made the question clear! Thanks for your help in advance.
In Dropdown1, Selected value set as {var:read_data.Model.dropdown1}. Events set to Reload Dropdown2 on change.
In Dropdown2, Selected value set as {var:read_data.Model.dropdown2}.
On page load, Dropdown1 rightly has {var:read_data.Model.dropdown1} as its value.
However Dropdown2 does not have any value selected.
in v6 the fields trigger the "change" event when they are loaded, in v7 they call the "Ready" event, I would sugget that you install v7 and give it a try on the same website!
We are using CCv6. The event is triggered on load, first Dropdown correctly shows the selected value automatically and reloads the second Dropdown with the correct corresponding options.
It's the second Dropdown that we cannot make it automatically set to its selected value from database, even though {var:read_data.Model.dropdown2} is put under "Selected values".
It's the second Dropdown that we cannot make it automatically set to its selected value from database, even though {var:read_data.Model.dropdown2} is put under "Selected values".
If somebody looking for this - you should add the read_action for the old data value on reload.
So, the steps would look like this:
1) read old data value in dropdown with read data>first matching record where id:{data:id}
2) put the value in the field data with data builder: Type:Data; Name: field_name; Value: {var:read_data_name.Model.field_name};
3) Read data for Dynamic dropdown as it was before;
4) view file field with custom code as it was before.
All of this is in Standalone action that is called by reload
So, the steps would look like this:
1) read old data value in dropdown with read data>first matching record where id:{data:id}
2) put the value in the field data with data builder: Type:Data; Name: field_name; Value: {var:read_data_name.Model.field_name};
3) Read data for Dynamic dropdown as it was before;
4) view file field with custom code as it was before.
All of this is in Standalone action that is called by reload
You need to login to be able to post a reply.