[MGNLFORM-117] One should be able to pre-fill form fields Created: 19/Dec/11 Updated: 27/Apr/12 Resolved: 26/Apr/12 |
|
| Status: | Closed |
| Project: | Magnolia Form Module |
| Component/s: | None |
| Affects Version/s: | 1.3.1 |
| Fix Version/s: | 1.3.3, 1.4.2 |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Will Scheidegger | Assignee: | Ondrej Chytil |
| Resolution: | Fixed | Votes: | 3 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Template: |
|
| Acceptance criteria: |
Empty
|
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
| Date of First Response: |
| Description |
|
Since it apparently is "best practice" to use the form module to for all kinds of user interaction one should be able to pre-fill form fields when displaying the form. A perfect example to illustrate this need is the stkPURUpdateForm paragraph which allows the user to update info about his/her user account. The form however is displayed empty. One can create a custom form engine and a form step state which sets the values in the fields, but you cannot add this manually created form state to the form engine (no setter method and private formState attribute). So either a setter method should be provided or then we should have an additional "formValuesInit" method which takes a hash with the values and does the rest. |
| Comments |
| Comment by Will Scheidegger [ 10/Jan/12 ] |
|
The attached patch adds a setter method for the FormState in the FormEngine object. This allows you to create your own FormState object and bind the default values from some other source when loading the form for the first time (i.e. by overwriting the handleTokenMissing() method). |
| Comment by Fabrice LAZZARI [ 24/Apr/12 ] |
|
Would be happy as well to get something done. I've solved the problem through a naughty hack using java reflection, but don't want to stay out of law during a too long time. Thanks in advance ! |