Nov 23rd, 2010, 03:15 AM
Design suggestion for CRUD
I have to design an application in grails which has the following requirement.
I have around 50 feedback forms, each one unique from the other. I should be able to create, read, update and delete each of the forms. I also need to be able to do a search based on the fields of each form.
Form 1: firstname, lastname, address
Should be able to do CRUD as well as search by first name, last name and address.
Form 2: patientname, doctorname, hospitalname
Should be able to do CRUD as well as search by patientname, doctorname, hospitalname.
Each form will have its own style and layout.
It will be really tedious to build all the 50 forms and define CRUD as well as search. Is there any alternative or a better approach using which this can be achieved?
Nov 23rd, 2010, 05:16 AM
Why not use custom scaffolding templates for your forms? I also suggest you try the bean-fields plugin, which aims to simplify form generation.
As for search, the Searchable Plugin makes that pretty straightforward, although it's not clear what you want to do with the search aspect. But the Searchable Plugin comes with a search page that you can use straight away to find out whether it's suitable for you or not.
Note that Searchable does not use database queries. Instead, it performs full text search using Lucence behind the scenes.
Hope that helps.
Nov 23rd, 2010, 09:27 AM
But since there are 50 forms, doing the same for each form would be really tedious. So I was thinking of having a GUI generator framework which reads in a XML (which contains all the form field definitions) and renders it on the UI using a XSL definition (for styling).
So do we have any such GUI generation plugin available in grails?
Search cannot be text based search. I have to have search based on each field of the form.
Nov 24th, 2010, 05:24 AM
Searchable allows you to search based on each field of a form if that form is backed by a domain class property. The syntax is:
Do you have domain classes for the forms? If so, then scaffolding is probably your best bet. Otherwise, I'm not convinced you're going to get much benefit out of an XML definition instead of using something like Bean Fields. The XML would be as verbose as the Bean Fields tags.
To be honest, it's hard to say what the most appropriate solution is without a more in-depth understanding of how you want your application to work. Are forms backed by domain classes? Where do the form definitions come from? Are they fixed up-front? Etc, etc.
Nov 24th, 2010, 09:03 PM
1) All the form fields are predefined. Not subject to changes. If changes do come for fields, it will be mostly increasing the fields length ( related to validations ) or adding of new fields.
2) All the fields in the form are well defined and have domain classes.
Tags for this Thread