Summary

There should be an utility class containing methods for an easy intuitive standardized creation of HTML code for basic input fields text, textarea, checkbox, radio and hidden.

To show the idea: JHTML::_('input.hidden', 'answer', 42);

I made one for me, and offer to use it under any licence you see fit.

Just put the attached file input.htm in \libraries\joomla\html\html.

Use JHTML::_('input.text', name, value, attribs, label).
Use JHTML::_('input.textarea', name, value, attribs, label).
Use JHTML::_('input.checkbox', name, value, attribs, label).
Use JHTML::_('input.radio', name, value, attribs, label).
Use JHTML::_('input.hidden', name, value, id).

Params except 'name' are optional.
String param 'value' speaks for itself.
Param 'attribs' accepts either string as an id for the input field, or an array of key/value pairs: use it for everything, i.e. array('class'=>'vista', 'style'=>'position:-2ft;', 'onDigout'=>'putBack();').
Param label accepts the label text of the field as string or array(text,pos) where pos is 'left' | 'right'. Whitout giving pos its left for text and right for checkbox and radio - as one would expect.

It's very useful for creating lots of hidden fields by looping thru an array or any numbered field array. The code reads better.

If the idea is approved, the class could be extended for basic button creation, images and imagemaps and the like.
Opened On:
13 Dec 2007, 8:39 by Mathias Hopf
Closed On:
4 Feb 2010, 3:16
Status:
Closed

Responses

Posted on 5 Feb 2009, 6:49 by chris K
yes, very useful , best solution i found ! thank you
Posted on 22 Feb 2009, 8:41 by Vladimir vldrimer
I can't download this file.
403 - Forbidden

???
Posted on 21 Jan 2010, 23:22 by Yves Renders
I can't download this file.
403 - Forbidden
Could you send it to me ?
Posted on 4 Feb 2010, 3:16 by Hannes Papenberg
This is already in 1.6. Closing this report.
Posted on 22 Feb 2010, 22:29 by Mathias Hopf
Its not in Joomla_1.6.0-Alpha2.