[MGNLPUR-205] Additional fields on the PUR form not working Created: 23/May/22 Updated: 03/Aug/22 Resolved: 26/May/22 |
|
| Status: | Closed |
| Project: | Magnolia Public User Registration |
| Component/s: | None |
| Affects Version/s: | 2.7.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Carlos Cantalapiedra | Assignee: | Evzen Fochr |
| Resolution: | Not an issue | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||
| Issue Links: |
|
||||
| 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)
|
||||
| Bug DoR: |
[ ]*
Steps to reproduce, expected, and actual results filled
[ ]*
Affected version filled
|
||||
| Epic Link: | PUR module improvements | ||||
| Team: | |||||
| Description |
|
Following the guide we provide at our docs to extend the userProfile we face an issue when sending the form to the processor: the parameters the createOrUpdateProfile method receives are empty, so no user is created in the end. Steps to reproduceWithin a Magnolia module, create a CustomUserProfile which extends UserProfile with the following code CustomUserProfile.java private String phoneNumber = ""; public String getPhoneNumber() { return phoneNumber; } public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } Include the jar at the Magnolia Public instance of your project. Startup Magnolia and set your class at /modules/public-user-registration/config/configurations/default/userProfileConfiguration@userProfileClass Now include an attribute at /modules/public-user-registration/config/configurations/default/userProfileConfiguration/autopopulatedProperties named phoneNumber Next step is define the customRegistrationForm as follows: my-module/customRegistration.yaml
title: User registration
templateScript: /my-module/templates/components/customRegistration.ftl
dialog: form:form
modelClass: info.magnolia.module.publicuserregistration.form.UserFormModel
class: info.magnolia.module.form.templates.components.FormParagraph
renderType: freemarker
formProcessors:
registration:
class: info.magnolia.module.publicuserregistration.processors.RegistrationProcessor
enabled: true
And the FTL could be something like: my-module/customRegistration.ftl <form name="${content.formName?default('form1')}" method="post" action="" enctype="multipart/form-data"> <div class="form-item-hidden"> <input type="hidden" name="mgnlModelExecutionUUID" value="${content.@uuid}"/> <input type="hidden" name="field" value="" /> <input type="hidden" name="csrf" value="${ctx.getAttribute('csrf')!''}" /> </div> <div class="form-section"> <div class="form-item-hidden"> <label for="username"> <span> Username <dfn title="required">*</dfn> </span> </label> <input name="username" id="username" required="" autofocus="" autocomplete="on" type="text" value=""> <br> <label for="password"> <span> Password <dfn title="required">*</dfn> </span> </label> <input name="password" id="password" required="" autocomplete="off" type="password" value=""> <br> <label for="passwordConfirmation"> <span> Password confirmation <dfn title="required">*</dfn> </span> </label> <input name="passwordConfirmation" id="passwordConfirmation" required="" autocomplete="off" type="password" value=""> <br> <label for="fullName"> <span> Full name <dfn title="required">*</dfn> </span> </label> <input name="fullName" id="fullName" required="" autocomplete="on" type="text" value=""> <br> <label for="phoneNumber"> <span> phone Number </span> </label> <input name="phoneNumber" id="phoneNumber" autocomplete="on" type="text" value=""> <br> <label for="email"> <span> Email <dfn title="required">*</dfn> </span> </label> <input name="email" id="email" required="" autocomplete="on" type="email" value=""> <br> <input type="submit" value="Register"> </div> </div> </form> Now include your new component within an area at a page template as follows mtk/templates/pages/basic.yaml register: id: my-module:components/customRegistration Now access the page and send the form. If you debug the RegistrationProcessor class, you will see that at the createOrUpdateProfile method, the parameters received are null when they should have data. Attached some screenshots that may help. |