I am trying to use Grails Scaffolding to quickly add a CRUD application around some old database tables (see https : //stackoverflow.com/questions/908161/... for the saga so far). I have already gone through the worst of problems and have a functional CRUD application, but there is one problem that remains with general usability.
Many of my domain objects have foreign key associations with other domain objects. A Contact
owned by Owner
, etc.
However, on the CRUD pages for Contact
I don’t want to see the actual id
key for Owner
... because it means nothing to users. I want the screen to display a more user-friendly value of Owner.name
.
The "List" and "Show" Views explicitly handle all the attributes in the automatically generated View code, and I have the ability to customize this code to control the presentation. However, the "create" and "edit" views do not list all attributes. Instead, those views make some kind of Grail tag of type Grails as follows:
... <fieldset class="form"> <g:render template="form"/> </fieldset> ...
This call seems to automatically detect during the execution of the field, and makes its own decisions about how to display them. For domain objects that have associations, this makes the wrong decision to display the associated gibberish object identifier rather than a more user-friendly attribute.
Is there a “simple” (or at least a “better way”) way to change the way the fields appear on the “edit” or “create” screen? Of course, this is a common problem when using forests is used with domain objects that have associations.
source share