Announcement Announcement Module
No announcement yet.
Combining Multiple Forms into single view Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combining Multiple Forms into single view

    Is there a "best practice" with regard to combining multiple forms for different entities on a single page? For example, I have some entities: User, Group, Permission, PermissionScheme, and PermissionSchemeEntry. PermissionSchemeEntry has an identifier type of PermissionSchemeEntryKey which consists of the PermissionScheme (ManyToOne) and Permission (Enumerated). It also has a ManyToMany relation to both User and Group. So, the idea is to first create just the PermissionScheme (ie. give it a name). On the update screen, I have the default update form for the PermissionScheme, followed by the PermissionSchemeEntry list view (which facilitates the update of a single entry), followed by the PermissionSchemeEntry create form (hidden scheme id/selectable permission). What I've done is simply jsp:include the views, and then populate the model attributes in the PermissionSchemeController. While this will probably work in most cases, I ran into an issue in this particular instance. Because PermissionSchemeEntry has a composite PK, it first calls the encodePk() JS function when the form is submitted. In encodePk(), the last line goes like so:
    dojo.byId('_${fn:escapeXml(compositePkField)}_id').value = encoded;
    which seemed to work in another app I was developing, but not this time. The reason is that there was already an "_id_id" field in the PermissionScheme update form. I changed the line like so:
    dojo.query('form#${modelAttribute} input#_${fn:escapeXml(compositePkField)}_id')[0].value = encoded;
    which resolved the issue. Any advice would be much appreciated. Thanks!