Bindings to the rescue: Changing an input label

I just read this post by Paul Roberston, Dynamically change a cfinput form field’s label. I agree that the way the input is generated into mxml does not make it easy to access the label. However, I think there is a simpler solution to the problem. Granted, this solution does not give you a "direct" pointer to the label, but it does change the label as needed.


I just read this post by Paul Roberston, Dynamically change a cfinput form field’s label. I agree that the way the input is generated into mxml does not make it easy to access the label. However, I think there is a simpler solution to the problem. Granted, this solution does not give you a "direct" pointer to the label, but it does change the label as needed.

The key change is that instead of separating the label and the field, you can use the label property of the input and a binding. He also makes the input appear and disappear depending on the dropdown selection. That too, can be done with a binding.

The complete code:

Live example

Download the source