Overview

When trying to create a component with an apostrophe or special characters in its name, the system displayed an error:

{
    "status": 422,
    "data": {
        "errors": [
            {
                "detail": "[id] Does not match the regex pattern ^[a-z]([a-zA-Z0-9_-]*[a-zA-Z0-9])*:[a-z]([a-zA-Z0-9_-]*[a-zA-Z0-9])*$/n[machineName] Does not match the regex pattern ^[a-z]([a-zA-Z0-9_-]*[a-zA-Z0-9])*$",
                "source": {
                    "pointer": ""
                }
            },
            {
                "detail": "The <em class=\"placeholder\">&quot;who&#039;s_live&quot;</em> machine name is not valid.",
                "source": {
                    "pointer": "machineName"
                }
            }
        ]
    }
}

Proposed resolution

User interface changes

Comments

mayur-sose created an issue. See original summary.

wim leers’s picture

Title: Special characters cause regex error when creating components » Special characters cause regex error when creating code components
Component: Page builder » Theme builder
Issue tags: +Usability
Related issues: +#3503547: Display validation errors in dialogs that create sections

This is expected. But the code component editor could inform the user more gently by performing client-side validation first.

Plus, the UI could surface the validation errors provided by the server explicitly, instead of telling the user to look at the browser console, by doing #3503547: Display validation errors in dialogs that create sections.

hooroomoo’s picture

Status: Active » Closed (duplicate)

Closing this as a duplicate because I am implementing the suggestion from #2 in #3520071: Show human readable error messages when creating component fails