History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GRAILS-182
Type: Sub-task Sub-task
Status: Open Open
Priority: Major Major
Assignee: Graeme Rocher
Reporter: Marc Palmer
Votes: 3
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Grails
GRAILS-3412

Add "hidden" constraint to allow suppression of fields in forms/scaffolded UI

Created: 26/Jun/06 08:07 AM   Updated: 19/Sep/08 04:24 AM
Component/s: View technologies, Scaffolding
Affects Version/s: 0.2
Fix Version/s: 1.1

Time Tracking:
Not Specified

File Attachments: 1. Text File BetterDisplayFix.txt (4 kb)
2. Text File MakeDisplayConstraintWork.txt (3 kb)



 Description  « Hide
The idea is that you could hide a property from scaffolded (or manually generated via metadata) forms, but the validation would still be applied in the ORM.

This is vital for internal generated fields such as password digests etc.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Sven Haiges - 24/Aug/06 03:52 AM
Exactly had this issue. As I use HBM files, my only problem was to delete some generated HTML from the GSP and compute the right value for the GORM domain class.

Drew Varner - 04/Jan/07 03:25 AM
I think this is handled by the simple contraint "display".

It looks like if display is set to false that the edit field is not rendered for Create and Edit views:

From src/scaffolding/org/codehaus/groovy/grails/scaffolding/DefaultGrailsTemplateGenerator.groovy (lines 44-45):

def display = (cp ? cp.display : true)
if(!display) return ''

However, it does not seem that the same check occurs in generateListView or generateShowView.

I'll look into it further, but I suspect this is actually a bug where scaffolding templates do not honor the constraint and not a New Feature.


Drew Varner - 08/Jan/07 03:02 AM
The following patch makes the "display" constraint work. Currently, the "display" constraint is honored in scaffolding with Create/Edit.

This patch modifies the templates for List and Show.

After this patch is applied, I need to create some documentation for the "display" constraint (which has been present for a while) to:

http://grails.org/Validation+Reference


Drew Varner - 08/Jan/07 07:44 AM
Use this patch instead!

First patch does not handle the "overwrite" variable correctly.

I am probably going to try to refactor this class some later.


Drew Varner - 11/Jan/07 02:07 AM
Ignore these patches. Graeme refactored the the scaffolding templates so it makes these invalid.

Marc Palmer - 19/Jan/07 04:46 AM
Yes we already have the "display" constraint. With Drew's patches it will be even better.

Drew Varner - 22/Jan/07 01:04 AM
I apologize for the delay. I have a bunch of patches related to scaffolding I have to merge. I have patches on my local machine in various phases of flux, including:

1) XHTML output for scaffolding
2) the "tbody"element patches for scaffolding
3) this patch

Scaffolding code has changed a good bit and many of my patches now require re-working. I'll try to get them up to speed this week.


Daiji Takamori - 12/Feb/07 09:10 PM
Please consider the changes in the code in the sandbox for http://grails.org/Scaffolding+of+field+editors which incorporate this functionality as well as what is described in the sandbox.

Nicolas Roblin - 03/Apr/08 05:19 AM
Hi, I do not really understant how it works.

But, has grails been improved to support "hidden property"? Or have I to modify my own grails on my computer? Or delete fields I want to hide from the gsp files?

I really would like to use generate-all command without needing to modify gsp for commons screen operations. And I really don't want to modify the grails application. (Too hard to maintain I think.)

Thanks.