How to get name instead of id in a select with relationship
Scenario: Select dependent that should be disabled based on the name of the other.
`
Is it possible to retrieve the name chosen in the first select component instead of the ID?
I know I can do get the record on DB based on Id and then get the namesomething like that based on id, but at first it seems like this information is already available on the first select, so I want to save this query to retrieve the name.
4 Replies
Reverse it. Instead of $get on the bar_id field $set it from the the foo_id field.
@awcodes
Sorry, but i didnt understood the tip. 😦
The opposite of $get is $set so you can set another field when that field changes.
Instead of getting the value.
Oh..
I think I made a mistake in the question and wrote too little or the initial question was poorly formulated.
the 2nd select will only be enabled if the name of the 1st is "X".. any other selected option must keep the 2nd select disabled. However, the 2nd select options do not use the key/name from the 1st to recover the data in the DB.
So, if I set the 'id' of the 2nd dropdown from the 1st using a set, I don't think it would help and I need the name select on the 1st.