Updating fields in a Section when a Select is changed based on a relationship.
For context, this is part of a laboratory system. A doctor completes a requisition, which is captured into the system. The requisition belongs to a patient:
A patient has many requisitions:
I need the requisition creation form to be able to select a patient, or create a new one if it exists. This works:
In addition, once the patient is selected, it must be displayed so that it can be updated in case any information has changed. I have made the Select live() in the hopes that the chosen or created patient's data can be presented in thuis section for editing:
I am obviously not doing the thing properly, because the fields in the section do not respond to changes in the select at all.
What do I need to do?
1 Reply
I have made a little progress. I have added a key to my Section:
and I have added a callback (taken from the docs) to the Select:
Now the patient details in the Section are emptied if I change the patient while editing the requisition.
How do I get the actual Patient model to fill those fields with?
Got it!