-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Required flag is being ignored for added fields #170
Comments
To be specific, this only happens if the field is set as Readonly. As seen in the code: silverstripe-memberprofiles/src/Forms/MemberProfileValidator.php Lines 47 to 49 in 32ab654
May I ask why is the check required for Readonly? I believe removing the check will make the form work again. There must be a reason the logic was implemented. Temporary fix: Unset "Readonly" to the field in Visibility |
The problem: Each field can have a distinct setting for readonly for each context. If a member custom field is set to be required but is readonly on the profilevisibility then it will not be shown as required on the either the profile form or registerform. It is true that a readonly field must not be set to be required, otherwise even if it is not being edited (and can’t be edited as a readonly field) the browser will demand that it be edited. This function fails to distinguish between the two contexts, where we may want it as required on the registerform, but not on the profileform. The fix:
The MemberProfileValidator deals with the field settings for required, and is modified below to accept the $context parameter. If the $context is ‘Register, then a required field is shown as required in the registerform even if it is readonly on the profileform, where it will now not be required.
|
All new fields set as required are not rendered as required fields. The only field rendered as required is Email. Example rendered code for a required field, missing the required="required" aria-required="true":
Is there a way to activate this?
The text was updated successfully, but these errors were encountered: