Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted August 28, 20195 yr 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?
August 28, 20195 yr 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")?
August 29, 20195 yr Author 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, 20195 yr by newbie LAC
November 19, 20204 yr @bfarber has this been resolved? - hidden but required fields are still required even though the user can't see them