newbie LAC Posted August 28, 2019 Posted August 28, 2019 Hello, I'm trying to add the toggles to built-in custom fields All works fine on the edit profile page But doesn't work on the registration page applications/core/modules/front/system/register.php if( $field->required and ( $values[ $field->name ] === NULL or !isset( $values[ $field->name ] ) ) ) { \IPS\Output::i()->error( 'reg_required_fields', '1C223/5', 403, '' ); } Any reason why you have added that code?
bfarber Posted August 28, 2019 Posted August 28, 2019 The code would appear to be in place to ensure fields required for registration are filled in. If you removed that code, does everything work as you are expecting (including required fields still being "required")?
newbie LAC Posted August 29, 2019 Author Posted August 29, 2019 (edited) 15 hours ago, bfarber said: The code would appear to be in place to ensure fields required for registration are filled in. It should do the Form helper Also \system\Helpers\Form\Form.php /* If this is dependant on a toggle which isn't set, don't return a value so that it doesn't trigger an error we cannot see */ if ( $element->htmlId and \in_array( $element->htmlId, $htmlIdsToIgnore ) ) { $values[ $_name ] = $stringValues ? $element::stringValue( $element->defaultValue ) : $element->defaultValue; continue; } So if the required field has been hidden by toggle we should not get an error. 15 hours ago, bfarber said: If you removed that code, does everything work as you are expecting Yes Without toggles The required fields validate by Helpers With toggles With toggles + I've removed \IPS\Output::i()->error( 'reg_required_fields', '1C223/5', 403, '' ); With toggles. Required field not filled Edited August 29, 2019 by newbie LAC BomAle, DawPi and PurplePixel 3
Solution bfarber Posted August 29, 2019 Solution Posted August 29, 2019 Thanks, I'll note this to have it checked on in a future release.
PurplePixel Posted November 19, 2020 Posted November 19, 2020 @bfarber has this been resolved? - hidden but required fields are still required even though the user can't see them
bfarber Posted November 25, 2020 Posted November 25, 2020 The report here was addressed some time ago, yes.
Recommended Posts