I am learning Grails and I have a question:
How do I prepopulate a field (like a list a check buttons)in Grails?
Please forgive me for such a trivial question. I have not tried anything yet. I am looking for general council as to the best way to do this in Grails.
ironmantis7x
Grails have the checkbox tag to create one checkbox. If you have a list, you can iterate over it and create the checkboxes, and the
checkedattribute will define if it will be marked or not.So you can have two lists:
Populate those lists in your controller, and in the view, iterate over list1. If the value exists also in the list2 (loaded from your file) you set the checked to true.
If you need a more specific answer you will need a more specific question.