Populating editor controls based on selection of dropdown
Populating editor controls based on selection of dropdown
Datagaard
Posts: 68Questions: 20Answers: 3
Hi Allan.
Pictures tell a thousand words. Its best explained using them, see below.
We want to populate a dropdown combo with the ScheduleItemCode in the editor from the table above. When the user selects this code, all remaining editor fields get their data defaulted, based on the selected rows other data fields.
Not sure how this is done.
Regards
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi,
Two options, depending upon what exactly you want (I suspect you already know, but I'm just clarifying for anyone else reading this thread):
1) The easiest option is just to have a foreign key reference to the ID column in your target table and then do a left join when reading the data back. That ensures referential integrity.
2) If however you just want to use that as a template and allow the user to change the values to be submitted and then saved individually into another table, then use
dependent()
to make an Ajax call when theselect
field is changed. The Ajax call would send the selected option to the server which would select the values from the table and return them, populating the form with those options, so the user can modify them as they need.Allan
Hi Allan,
Thanks for the answer, it actually answers two scenarios of which we will use.