Jump to content

Custom fields. Registration.Toggles


Go to solution Solved by bfarber,

Recommended Posts

Posted

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?

 

Posted

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")?

Posted (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

toggle.thumb.gif.0935a0ccc9d2e2c4462e98ea453ba9b8.gif

The required fields validate by Helpers

With toggles

toggle2.thumb.gif.73d7adf696552942b2a81953637659f7.gif

With toggles + I've removed 

							\IPS\Output::i()->error( 'reg_required_fields', '1C223/5', 403, '' );

toggle3.thumb.gif.19947518c202a75c842f5870c9aab486.gif

With toggles. Required field not filled

toggle4.thumb.gif.c8e0866be1416c40542f42fd2bd3b9ff.gif

Edited by newbie LAC
  • 1 year later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...