PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #1430

feature request: label for html elements

Details

Submitted2004-05-18 07:54 UTC
Frommartel at post dot pl
StatusWont fix
PackageHTML_QuickForm
PHP Version4.3.6
OSGentoo 2004.0
Roadmaps(Not assigned)

Comments

[2004-05-18 07:54 UTC] martel at post dot pl

Description:
------------
Could you please make the QF to use the label html tag?

W3C Reference: http://www.w3.org/TR/html401/interact/forms.html#h-17.9

Actually it's impossible to implement outside version of <label> (in order to place it in a table cell, for example) since the form element is missing id attribute. I think you can easily add id alongside with a name since it already has to be unique.

I'm using QF 3.2.2

Reproduce code:
---------------
$opts = array("size" => 32, "maxlength" => 32);
$form->addElement('text', 'login', 'Username:', $opts);

Expected result:
----------------
<label for="login">Username</label>
<input size="32" maxlength="32" id="login" name="login" type="text" />

Actual result:
--------------
Username
<input size="32" maxlength="32" name="login" type="text" />

[2004-05-18 11:12 UTC] martel at post dot pl

Considering your "fix" I generaly agree I was wrong (with the assumption that it's impossible to do). However I don't think it's a good practice to mix html with the business logic. I think it would be great if the qf engine would produce it on it's own (since it already has the needed data)

[2004-05-19 11:55 UTC] martel at post dot pl

Well, I'm definitely not using any html in _my_ business logic since I'm using smarty and QF duo. But that's just for the sake of clarification.

You have already persuaded me to belive that it's not as simple as I originaly thought. Yet I'm still saying that it should be implemented as a feature (eventually I'll do it myself in the future as a patch, just like you suggested) since it's a HTML standard.

As for the second example of the problems, it's pretty irrelevant since the default behavior of the label is to bring a focus to the labeled element. But let's not argue, it won't help anybody.

My second request: could you give unique IDs to each element , please? They have been there in the older versions of QF, if I remember correctly (they were named like qf_1345). Is it possible to bring them back? Or just simulate this behavior? It would allow me/us to keep the logic separated from the view.

PS. I'm sorry if I sound kind of rude to you - I don't mean it. Simply, english is not my native language, and as such it could be a little crude.