Select Component inside helper class is not updated
I have a Select Component for a Form that is inside a helper class. This Select Component is depending on some other values from the Form itself. If I put the Select Component on the Form, use
live()
on the other components, all works.
As soon I move the Select Component to a helper class, it doesn't update anymore. I then first have to save the Form and reload the page.
Updated Select:
If I use the Select Component right away, all works fine.
Is this by design, or do I forget something?6 Replies
What's happening inside of
TemplateHelper::getTemplates()
?It is just returning a Select component. The query for the Options is a bit complex, so therefore AND for DRY purposes I decided to use a helper.
Sorry, I think I don't understand what you're trying to do. Why do you need to
$get()
the value and pass it in to the helper that is generating the field?This is my helper. Maybe that makes more sense?
Not sure... I see
getTemplateOptions()
vs. self::getOptions()
So, I in my Form I use:
getTemplates
. This returns the Select Component. That works fine. I made the getTemplateOptions
public, since I also tried to just get the options()
from the helper. This works also and is what I currently use:
So, in the last approach I use, the Select Component is on the Form itself. If I then update e.g. the Client
or the ContentType
Select Components, this Select is being updated. If I move this to the helper class, it isn't updated anymore.