Forum
Form attributes getting stripped
I'm using Perch Forms and have noticed that certain tags get stripped or mutated. Examples of those that I have found are:
- novalidate getting stripped on <form> tag.
- accesskey="1" (etc) gets stripped
- autocapitalize="none" (etc) gets stripped
- autocomplete="name" (etc) gets mutated to autocomplete="autocomplete"
- autocorrect="off" gets stripped
- autosave="1234" (etc) gets stripped
- disabled gets stripped
- inputmode="verbatim" (etc) gets stripped
- minlength="1" (etc) gets stripped
- readonly gets stripped
- spellcheck="false" (etc) gets stripped.
Is it likely that these will be added in a future release of Perch?
Cheers
I'm not sure all of those a valid attributes. Of the valid ones, can you give an example of where they're being stripped?
If so, we'll absolutely fix it.
The novalidate one is being stripped on my <perch:form> tag. There are tags there that are specific to iOS, autocapitalize and autocorrect. Although they aren't standards based they are useful for username and email fields. Of the rest, they are all getting stripped on text and number based input types.
Theres a full list of tags here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input and here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
name="..." also gets stripped from <perch:form>.
Can you confirm you have
PERCH_HTML5
set to true?Hi Drew,
Apologies for the very late reply, I stopped working on the site in question and forgot about this post!
I've just checked my config and can confirm that PERCH_HTML is set to true.
I did some work to add a load of these a few versions back. Have you updated to the latest?
I'll go through and check these for you now as I'm updated to latest
Hi Drew,
I've taken a look at my examples and there are a few that aren't working quite right. spellcheck="false" is getting stripped still. The other three: novalidate, disabled and readonly are getting omitted when their values are not set. E.g novalidate="novalidate", disabled="disabled", readonly="true" all work, but these boolean attributes don't require a value to be set in order to be used.
Remember you're writing Perch template tags, not HTML5 tags. Perch template tags require attributes to have a value.
Ok will do, thanks for the help.