Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 Yesterday 18:42:27

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,295
Website GitHub

etc_attribute and data-… attributes?

I love this tiny unassuming plugin. It’s just perfect for adding aria and role etc. to a tag’s output. However I’ve managed to get it throw an error when adding a data-xyz attribute to com_connect. I have the following in my etc_attribute prefs:

rel="a|area|link"
style="\w+"
role="\w+"
data-error="\w+"

and this in my tag:

<txp:com_connect_email break="" autocomplete data-error="Please enter a valid email address" />

which gives me:

Textpattern Notice: Unknown tag attribute: data-error Issue detected while parsing form …

But it does add the data-error attribute to … the label.

I guess that plugin is a special case, or am I doing something wrong?


TXP Builders – finely-crafted code, design and txp

Offline

#2 Today 10:12:46

etc
Developer
Registered: 2010-11-11
Posts: 5,704
Website GitHub

Re: etc_attribute and data-… attributes?

Is it really etc_attribute that throws this error? When I call just <txp:com_connect_email break="" autocomplete />, I already get

Tag error: <txp:com_connect_email break="" autocomplete /> ->  Warning: Trying to access array offset on null Issue detected while parsing form default on page archive

Offline

#3 Today 11:26:50

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,295
Website GitHub

Re: etc_attribute and data-… attributes?

Thanks for looking at this. I don’t get the error you mention on my site (with the txp 4.9 version of com_connect). The autocomplete attribute is listed as valid for the tag and is valid html. The bit that triggers the error is adding the data-error="…" attribute. Removing it silences the error again.

This is the entire error trace, if it helps:

Tag error: <txp:com_connect_email break="" autocomplete data-error="Please enter a valid email address" /> ->  Textpattern Notice: Unknown tag attribute: data-error Issue detected while parsing form ___ on page ___
textpattern/plugins/com_connect/com_connect.php:1738 trigger_error()
textpattern/plugins/com_connect/com_connect.php:701 com_connect_lAtts()
com_connect_email()
textpattern/vendors/Textpattern/Tag/Registry.php:140 call_user_func()
textpattern/lib/txplib_publish.php:540 Textpattern\Tag\Registry->process()
textpattern/lib/txplib_publish.php:429 processTags()
textpattern/plugins/com_connect/com_connect.php:200 parse()
com_connect()
textpattern/vendors/Textpattern/Tag/Registry.php:140 call_user_func()
textpattern/lib/txplib_publish.php:540 Textpattern\Tag\Registry->process()

No mention of etc_attribute in there. I wondered whether it might have to do with the relative load orders of the plugins and tried various alternatives but with no effect.


TXP Builders – finely-crafted code, design and txp

Offline

#4 Today 11:37:28

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,682
Website

Re: etc_attribute and data-… attributes?

jakob wrote #343195:

Thanks for looking at this. I don’t get the error you mention on my site (with the txp 4.9 version of com_connect). The autocomplete attribute is listed as valid for the tag and is valid html. The bit that triggers the error is adding the data-error="…" attribute. Removing it silences the error again.

I don’t get that error Oleg mentions either, although I suspect com_connect prefers to have an actual value for the autocomplete attribute. The help file suggest “on” or “off”, mines work with “email” for the relevant com_connect_email tag.

Left without value, the com_connect generated code appears to be autocomplete=1, whatever that might actually mean (and not a valid value, afaik). It does not trigger an error (debugging mode, PHP 8.5.x, TXP 4.9.2-dev).


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#5 Today 11:55:04

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,295
Website GitHub

Re: etc_attribute and data-… attributes?

phiw13 wrote #343196:

I don’t get that error Oleg mentions either…

Thinking aloud, maybe that happens with the non-txp-4.9 version or with xhtml set in the prefs rather than html5. If I’ve read the code properly, autocomplete is not valid for xhtml.

Left without value, the com_connect generated code appears to be autocomplete=1, whatever that might actually mean (and not a valid value, afaik).

It is one of the boolean attributes that the com_connect tags accept.


TXP Builders – finely-crafted code, design and txp

Offline

#6 Today 12:12:31

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,682
Website

Re: etc_attribute and data-… attributes?

> It is one of the boolean attributes that the com_connect tags accept.

I don’t see autocomplete listed as boolean there ?

And anyway, in the HTML output autocomplete=1 is not valid.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg

Offline

#7 Today 13:24:14

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,295
Website GitHub

Re: etc_attribute and data-… attributes?

phiw13 wrote #343198:

> It is one of the boolean attributes that the com_connect tags accept.

I don’t see autocomplete listed as boolean there ?

And anyway, in the HTML output autocomplete=1 is not valid.

My bad! You’re right in both cases. Apologies, I oversaw that.

It doesn’t have any bearing on the original question, though.


TXP Builders – finely-crafted code, design and txp

Offline

#8 Today 13:28:33

etc
Developer
Registered: 2010-11-11
Posts: 5,704
Website GitHub

Re: etc_attribute and data-… attributes?

Should I put <txp:com_connect_email break="" autocomplete /> inside some container? I’m not familiar with com_connect, sorry.

Anyway, the message seems to come from com_connect_lAtts() function. I’m not sure it needs to be updated to use global attributes added via plugins.

Offline

Board footer

Powered by FluxBB