[TYPO3] How to add a class argument to every password form field?

Christopher Torgalson bedlamhotel at gmail.com
Fri Jul 13 18:53:28 CEST 2007


Hi,

On 7/13/07, Andreas Balzer <typo3 at andreas-balzer.de> wrote:
> Christopher Torgalson schrieb:
> > Hi,
> > The answer to rendering questions (i.e. questions regarding the HTML
> > output) is /always/ 'check the TS object browser'.
> >
> > In this case, you're looking for tt_content.login.20 (which is a FORM
> > cObject).
>
> Hi! Well in general I would like to do it with every form field (later
> on also normal text input fields) from all extensions etc. Isn't there a
> way to do it automatically? Some general T3 setting like "if you output
> a form field without any class attribute then insert one..



You weren't listening ;-)

The answer is still mostly 'check the TS object browser'--that will
let you take care of the mailform and login form elements, as well as
to learn how to do what you need anytime you build a form using
Typoscript.

As for forms in extensions, there is, at the moment, no method to add
anything to /any/ of the template markup except by the old-fashioned
'change-the-html-in-the-template' method (assuming that the extension
even provides and editable template in the first place).

Incidentally, the /only/ reason for adding classes to form fields is
because IE does not properly support attribute selectors [1]. In about
any /other/ modern browser you could just do this:

input[type=password] {
  border:2px solid #900;
}

And, in fact, there is a simple method to do the same in IE, though
unfortunately it relies on javascript (and, since it's invalid CSS,
would best be delivered to the browser in a stylesheet called via
conditional comments):

input {
  border: expression(this.type=="password"? '2px solid #900' : '/* None */');
}



-- 
Christopher Torgalson
http://www.typo3apprentice.com/


[1] http://www.w3.org/TR/CSS21/selector.html#attribute-selectors


More information about the TYPO3-english mailing list