> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ollie.shop/llms.txt
> Use this file to discover all available pages before exploring further.

# Form Fields

> Tighten or relax the validation of the native address, profile and card forms per version with the formFieldsController prop

The native forms validate what shoppers type: maximum lengths and regular expressions for the address fields, the contact phone, and the cardholder name. A version can override those rules with the **`formFieldsController`** prop, without touching any component.

Typical reasons: a carrier that rejects long street names, a platform that only accepts digits in the house number, or a market where the default character rules are too strict.

## Where to edit

**Admin → Versions → your version → Props Configuration → Custom props.** Click **Add Form config** in the empty state, or **+ Add Prop** and pick **Form config** from the list, then edit the JSON and click **Save Changes**.

![Version Props Configuration tab](https://mintcdn.com/ollie/ZKpSeyUd64Smy50J/images/admin-version-props.png?fit=max\&auto=format\&n=ZKpSeyUd64Smy50J\&q=85\&s=47b1b4489ee4d928872f5b209758ef37)

The Custom props block with its presets

> [!WARNING]
>
> The preset the Admin inserts is an example, not the built-in defaults. Review every field it lists before saving, and delete the ones you do not want to change.

## Shape

```ts theme={"system"}
{
  address?: {
    number?:       FieldControl;
    neighborhood?: FieldControl;
    street?:       FieldControl;
    complement?:   FieldControl;
    reference?:    FieldControl;
    name?:         FieldControl;   // applies to first name and last name
    city?:         FieldControl;
    phone?:        FieldControl;   // applies to phone and company phone, checked against the digits only
  };
  profile?: {
    phone?:        FieldControl;   // the contact-details modal; independent of address.phone
  };
  creditCard?: {
    name?: { maxLength?: number; regex?: string };   // a single pattern as a string
  };
}

type FieldControl = {
  maxLength?: number;
  regex?: Array<{ id: string; pattern: string }>;
};
```

How the rules apply:

* A field you leave out keeps the built-in rules.
* For a field you include, your `regex` list **replaces** the built-in patterns for that field, and `maxLength` replaces the built-in limit. Include every pattern you still want.
* Patterns are tested with the Unicode flag, so `\p{L}` works.
* When a pattern fails, the shopper sees the message with key **`addressForm_<id>`**. Two ids ship with messages in every locale: `specialCharsValidationMessage` and `lettersOnlyValidationMessage`. For a new id, add the `addressForm_<id>` message in the [Messages tab](/ollie-shop/configuration/translation.md).

## Example

Allow only digits in the house number, keep the standard character rule on the street with a shorter limit, forbid digits in names, limit the contact phone, and shorten the cardholder name:

```json formFieldsController theme={"system"}
{
  "address": {
    "number": {
      "maxLength": 10,
      "regex": [{ "id": "digitsOnlyValidationMessage", "pattern": "^[0-9]+$" }]
    },
    "street": {
      "maxLength": 200,
      "regex": [{ "id": "specialCharsValidationMessage", "pattern": "^(?![\\d.]+$)[\\p{L}0-9\\s\\-.,#&'’()/]*$" }]
    },
    "name": {
      "regex": [{ "id": "lettersOnlyValidationMessage", "pattern": "^[^0-9]*$" }]
    }
  },
  "profile": {
    "phone": { "maxLength": 11 }
  },
  "creditCard": {
    "name": { "maxLength": 60, "regex": "^[^0-9]{1,60}$" }
  }
}
```

The `digitsOnlyValidationMessage` id above is new, so pair it with a message in the `ui` row of the Messages tab:

```json ui theme={"system"}
{
  "addressForm_digitsOnlyValidationMessage": "Use digits only"
}
```

> [!NOTE]
>
> Remember to escape backslashes in JSON: `\d` is written `\\d`.

## Related

* [Translations](/ollie-shop/configuration/translation.md): the messages the validation ids point to
* [Checkout Flags](/ollie-shop/configuration/feature-flags.md): the other settings on the Props tab
* [Managing Versions](/ollie-shop/configuration/versions.md): how the Props tab saves


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.