auto-complete fields
Archived from the Xataface Users forum.
butchseaman — Thu Feb 11, 2010 12:14 pm
I have two tables I am working with.
client_info
policy_information
I select a record in client_info and it list the associated records when in detail view.
I select one of the associated records and it gives me associated information.
What I want is to have a name field auto populate from the client_info in the associated record when viewing.
Not sure if this makes sense …
not sure how to get this done….
Thanks in advance for your advice
shannah — Thu Feb 11, 2010 3:12 pm
There are a few ways to accomplish this.
-
Use a vocabulary on the client_info_id field so that it is displayed as something more human readable in the interface when it is displayed.
-
Use the __sql__ directive to “graft” some fields onto the end of the associated_records table.
e.g.
in the fields.ini file for the associated_records table.
- Code: Select all
__sql__ = "select a.*, c.client_name from associated_records a left join client_info c on a.client_info_id=c.client_info_id"
- Implement the fieldname__display() for a field to be more descriptive (loading info about the client_info from the database).
-Steve