apache / apache/grails-core

Missing of 'readonly' attribute configurabiltiy!

Open
#14,233 5 comments 4 reactions 0 assignees View on GitHub
relates-to: grails-fields
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

The possibility to configure that a field in `f:field` or more fields in `f:all` to be `readonly` seems to be missing :( .

Even if one passes this attibute, it's being ignored :( .

It is very frequent scenario that some fields need to be readonly e.g. when editing vs creating.

Thank you.

----
**Edit on 20-March to clarify**:
This issue consists of **two** parts, both related to the "readonly handling" in this plug-in:
1. support in ``, since quite often when editing an entity after it was created, some fields must not be editable anymore.
2. support in ``
- users would expected `` however, since `readonly` is not a custom property to be used with `widget-*`, but one that the default templates seem to use.
- even with `widget-*`, this is still **not** working always correctly, since the default templates do not implement this right ( grails/grails-views#650 might have helped to see rendering bug):
- see https://github.com/aadrian/fieldbugs1/blob/master/grails-app/views/tableTwo/edit.gsp#L38 : it is still possible to change the value of `strType` and `intgNo` despite being readonly like `strName` (only this one works correctly). Just run the example from https://github.com/aadrian/fieldbugs1 with `grails run-app` to see this in action.

Contributor guide

Open the contributing guide

Research direction

Start with the f:field and f:all usage in the issue and run the linked fieldbugs1 example with `grails run-app`. Inspect `grails-app/views/tableTwo/edit.gsp#L38` and the default templates to compare readonly handling for strName, strType, and intgNo. Done means both tags consistently prevent editing for the requested fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.