Skip to content

JS form validation error with EXT:fnn_powermail_altcha #1277

@akiessling

Description

@akiessling

Hi,

i'm trying to get https://github.com/599media/fnn_powermail_altcha running for a local-only captcha solution.

Unfortunately, the JS validation fails since the initially created altcha checkbox-field does not have a name attribute.
When the checkbox is clicked, it is removed and a hidden field with a name attribute is created, then the validation works.

So when nothing is entered in the form and i hit the submit button, the js validation throws an error, the form is submitted, the server validation kicks in and i see an error in the JS console

Form.min.js?1726555609:1 Uncaught TypeError: Cannot read properties of null (reading 'replace')

which seems to track down to

#getFieldIdentifier(field) {
let name = field.getAttribute('name');
return name.replace(/[^\w\s]/gi, '');
};

See also 599media/fnn_powermail_altcha#4

Maybe the JS validation should ignore fields in the form that have no name attribute?
I tried setting data-powermail-validation="disabled" to the altcha web component, but it seems like arbitrary data attributes are not supported

I'm currently on TYPO3 11.5 with powermail 10.9, but the code does not seem to have changed in that area

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions