Field Length

I need to increase the length of address1district which only allows 30 characters. I’ve gone to user_manage_edit.php and found

$row->addTextFieldDistrict(‘address1District’).

I’ve copied the maxLength() from address1:

$row->addTextFieldDistrict(‘address1District’)->maxLength(255);

But it still only allows 30 characters. Is there something else I need to do?

Hi Andy,

The length is also limited in the database, be sure to edit the address1District in the gibbonPerson table.

There’s also a district field in gibbonFamily that may also be worth changing.

I checked gibbonPerson and gibbonFamily, varchar(255).
I changed the code but it didn’t change the field length on the form.

$row = $form->addRow()->addClass(‘address’);
$row->addLabel(‘address1District’, (‘Address 1 District’))->description((‘County, State, District’));
$row->addTextFieldDistrict(‘address1District’)->maxLength(255);

Is this the correct syntax?
And I changed the field name to make sure I was editing the right field!

Ah right, looks like districts have auto-complete added to them so addTextFieldDistrict is a predefined field type. Rather than updating all the forms you should be able to just change it in one place, line 538 in src/Forms/DatabaseFormFactory.php (in v16.0.00)

Yeah, that fixed it. Thanks Sandra.

Hi Andy, if you perform a pull request on that change, then we can include it in v17, and your change won’t get overwritten on update.