469,342 Members | 5,936 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,342 developers. It's quick & easy.

input type=text maxlength=5 -> can this go into a css?

hi all.

i've almost finished moving all the tags from html to my css.

however, i can't find a way (if there's one) to move the property
maxlength of an <input type=text ...tag to the css in which i define
a class for my input's (colors, width, font and so on).

i'd appreciate if anybody could tell me if i'm looking for something
that doesn't exist or if i just cannot find it.

thank you in advance.
--
Gianni Rondinini (31, tanti, RA)
Nikon user - Bmw driver
http://bugbarbeq.deviantart.com
Jul 26 '06 #1
8 28205
Gianni Rondinini schrieb:
hi all.

i've almost finished moving all the tags from html to my css.

however, i can't find a way (if there's one) to move the property
maxlength of an <input type=text ...tag to the css in which i define
a class for my input's (colors, width, font and so on).

i'd appreciate if anybody could tell me if i'm looking for something
that doesn't exist or if i just cannot find it.
You are looking for something that is not even a good idea :-) CSS is to
be used for everything that concerns presentation. CSS can be dropped or
overridden, in some cases (such as text-only browsers or screen readers)
it has no relevance at all.

Maxlength is not presentation, but functionality, so this must remain in
the HTML code, such as the form action or the form method, or the input
type.

--
Markus
Jul 26 '06 #2
Gianni Rondinini schrieb:
hi all.

i've almost finished moving all the tags from html to my css.

however, i can't find a way (if there's one) to move the property
maxlength of an <input type=text ...tag to the css in which i define
a class for my input's (colors, width, font and so on).
You can't. Maxlength is an HTML attribute. It has nothing to do with
representation (aka CSS), because it effectively limits the maximum
number of characters one can enter into a text field.

Jul 26 '06 #3
On Wed, 26 Jul 2006, Christian Kirsch wrote:
Maxlength is an HTML attribute.
Agreed. It's the "size" attribute which is relevant to presentation.
[... maxlength] effectively limits the maximum number of characters
one can enter into a text field.
"effectively"? Yes, it tells a conforming client to limit the length
of input; but it has no effect on those who submit malicious input.

Far too many people have written server-side scripts which relied on
this kind of constraint in their own form, but which turned into a
security exposure when someone tweaked the HTML (or scripted their own
version of the form submission).

One should never forget the need to validate every substantive aspect
of a form submission, *at the server*, never placing any trust on
constraints which were attempted to be imposed on the client by the
HTML, javascript, etc.

Nothing personal, but I see the consequences of a fairly steady stream
of these kinds of system design error, so I do think it bears
repeating.
Jul 26 '06 #4
Alan J. Flavell schrieb:
On Wed, 26 Jul 2006, Christian Kirsch wrote:
>Maxlength is an HTML attribute.

Agreed. It's the "size" attribute which is relevant to presentation.
>[... maxlength] effectively limits the maximum number of characters
one can enter into a text field.

"effectively"? Yes, it tells a conforming client to limit the length
of input; but it has no effect on those who submit malicious input.
or may be efficiently? English is not my native language, so please
forgive me for having been carried away by adjectivities.

Jul 26 '06 #5
On Wed, 26 Jul 2006, Christian Kirsch wrote:
Alan J. Flavell schrieb:
"effectively"? Yes, it tells a conforming client to limit the length
of input; but it has no effect on those who submit malicious input.

or may be efficiently? English is not my native language,
klar - aber ueber Sprachkentnisse wollte ich wirklich nicht meckern,
ehrlich.
so please forgive me for having been carried away by adjectivities.
Maybe we have a problem with "effective/effektiv" in the sense of
"wirksam", as opposed to the sense of "wird schon gehen".

Native English speakers often enough do not make the distinction,
either - and it was that point which prompted my followup: that
maxlength is only effective/wirksam if the client honours it. It's by
no means a complete way of limiting input to a server-side script.

(For non-German-speakers: I'm only trying to assure Christian that I
hadn't intended any criticism of his command of English. And given
him a chance to laugh at my German ;-).

btw: "efficient" would not be the right word in the above context.
Jul 26 '06 #6
On Wed, 26 Jul 2006 13:52:21 +0100, "Alan J. Flavell"
<fl*****@physics.gla.ac.ukwrote:
>"effectively"? Yes, it tells a conforming client to limit the length
of input; but it has no effect on those who submit malicious input.
you are perfectly right. i didn't write this, but this page is going
to be used only by internal trusted users and security isn't an issue
with this very exact thing.

however, thanks for pointing this out: i'll keep it in mind.

regards,
--
Gianni Rondinini (31, tanti, RA)
Nikon user - Bmw driver
http://bugbarbeq.deviantart.com
Jul 26 '06 #7
On Wed, 26 Jul 2006 12:22:52 +0200, Markus Ernst
<derernst@NO#SP#AMgmx.chwrote:
>Maxlength is not presentation, but functionality, so this must remain in
the HTML code, such as the form action or the form method, or the input
type.
got it.
thanks.
--
Gianni Rondinini (31, tanti, RA)
Nikon user - Bmw driver
http://bugbarbeq.deviantart.com
Jul 26 '06 #8
In message <Pi*******************************@ppepc87.ph.gla. ac.uk>,
Alan J. Flavell <fl*****@physics.gla.ac.ukwrites
>klar - aber ueber Sprachkentnisse wollte ich wirklich nicht meckern,
ehrlich.
That's you failed the Turing test, then.
--
Andy Mabbett
Say "NO!" to compulsory ID Cards: <http://www.no2id.net/>

Free Our Data: <http://www.freeourdata.org.uk>
Jul 26 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by multimatum2 | last post: by
4 posts views Thread by Jerry | last post: by
5 posts views Thread by len.hartley | last post: by
11 posts views Thread by C.W.Holeman II | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.