|
I've looked at the docs for the form helper for select. It's not clear why there is a select() and selectTag() but that's not my primary question. How would I convert the following code into a form helper using select()? Notice that it selects the existing value for editing an existing record. Also notice that the value stored in the db is the same thing as what is shown in the UI. It's not obvious how to do this. I tried creating a struct like this: But it doesn't pre-select existing values. It also stores the number value or key of the struct. I'm looking for clean and simple here. Maybe there isn't? |
Replies: 3 comments 4 replies
|
It also appears to not work to mix form helpers with regular html tags either such as this: As this submitted value shows up in params scope and not in the params.journalEntry object. :( |
|
Just found that when I use an array of string values for the options, it all just works fine. Because the objectName object has an entry_type element with value that matches one of those in that array, it does pre-select it and then if changed and the form is submitted, it captures and stores the new value chosen in the params.journalEntry.entry_type. |
|
FYI, With |
Just found that when I use an array of string values for the options, it all just works fine.
entryTypeOptions = ["Accomplishment", "Comment", "Scope Adjustment"];Because the objectName object has an entry_type element with value that matches one of those in that array, it does pre-select it and then if changed and the form is submitted, it captures and stores the new value chosen in the params.journalEntry.entry_type.