W3C home > Mailing lists > Public > public-html@w3.org > March 2013

Proposal: Improve <input> validation

From: Benjamin Blum <benjamin.blum.98@gmail.com>
Date: Tue, 19 Mar 2013 17:27:06 +0100
Message-ID: <CAN-uwpJjXZ9q8y59f0XHnh1gra82c1PPmwJ-6F3DtD3QtYjozg@mail.gmail.com>
To: public-html@w3.org
Madam, Sir.

I'm working on a register form and note that the new <input> constraints
(new types and pattern attribute) isn't enough.
An identical constraint will be usefull for checking if password or email
are correctly written.

<input type="email" name="email_main" />
<input type="email" name="email_confirm" identical="email_main" />

The identical attribute informs on the reference <input> by his name.
It's limited to the same <form>.
The identical constraint override the type validation with a basic test
(see below)
As a result, the type attribute may be ommited in this case, the type of
the reference input will be used instead.

if email_confirm.value == email_main.value
then
    email_confirm.isvalid = email_main.isvalid;
else
    email_confirm.isvalid = false;
end
Received on Tuesday, 19 March 2013 16:46:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:37 UTC