Welcome! » Log In » Create A New Profile

Add attribute for html5 input type

Posted by Edward 
Add attribute for html5 input type
August 19, 2017 09:48AM

I tried add attribute maxlength eg. $def->addAttribute('input', 'maxlength', 'Number'); for input type=tel. However, I did not succeed. In the code I found this:

if (isset($attr['maxlength']) && $t !== 'text' && $t !== 'password') { unset($attr['maxlength']); }

Why is this done? Except text, many new types have been added: color date datetime-local email month number range search tel time url week

Re: Add attribute for html5 input type
August 24, 2017 10:26PM

You're best of patching HTML Purifier in this case, I'm afraid.

Your Email:


HTML input is enabled. Make sure you escape all HTML and angled brackets with < and >.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}