Error when adding address field in publicRegistration

I’m stuck on this error, I tried fixing this error.

$row = $form->addRow();
$row->addAlert((‘Address information for an individual only needs to be set under the following conditions:’), ‘warning’)
->append(‘

    ’)
    ->append(‘
  1. ’.(‘If the user is not in a family.’).‘
  2. ’)
    ->append(‘
  3. ’.(‘If the user\‘s family does not have a home address set.’).’
  4. ‘)
    ->append(’
  5. '.(‘If the user needs an address in addition to their family\‘s home address.’).’
  6. ‘)
    ->append(’
');

$row = $form->addRow()->addClass('address');
$row->addLabel('address1', __('Address 1'))->description(__('Unit, Building, Street'));
$row->addTextField('address1')->maxLength(255)->required();

$row = $form->addRow()->addClass('address');
$row->addLabel('address1District', __('Address 1 District'))->description(__('County, State, District'));
$row->addTextFieldDistrict('address1District')->required();

$row = $form->addRow()->addClass('address');
$row->addLabel('address1Country', __('Address 1 Country'));
$row->addSelectCountry('address1Country')->required();</i>

I copied this code from user_manage_add.php

can someone please guide me?

Adding the following line at the top should fix this:

use Gibbon\Forms\DatabaseFormFactory;

:wink:

Thanx for the help!

When I added it it didn’t work at first.
After I added this it worked for me. (line 63 & 64)

I hope it helps someone.

Again thnx @meierrom !