Justin wrote:

> I'm trying to decide on a nice semantic way to mark-up a short (usually
> only a few words) block of help text in the context of a web form.

The <label> element can contain inline elements (like <input />). So you can wrap it 
around the <input> in your example and perhaps remove the <p> from the help text to 
include it as well:

   <form...>
      <div class="formitem">
         <label for="f-title">Label: <input id="f-title" type="text... />
         Helpful text goes here
         </label>
      </div>
   </form>

This way, the help text is associated with the relevant form control.

Owen

-----Original Message-----
From: Justin French [mailto:[EMAIL PROTECTED]
Sent: 22 July 2004 15:25
To: [EMAIL PROTECTED]
Subject: [WSG] semantic way to mark up form help?


Hi all,

I'm trying to decide on a nice semantic way to mark-up a short (usually 
only a few words) block of help text in the context of a web form.  I 
currently use a label to label the input, and a paragraph or div to 
mark-up the help text:

<form...>
        <div class='formitem'>
                <label for='f-title'>...</label>
                <input id='f-title' type='text'... />
                <p class='help'>This is the title of your news post, which does not 
accept HTML input</p>
        </div>
</form>

But logic tells me that in the above example, the <p> help text is not 
associated with the form widget or the label at all.  The only way I 
can see this being done is by including the help text in the label, but 
this will restrict me in terms of layouts.

Honestly, the most logical way I can see to do this is to have them in 
three cells of a table row, since at least they'll be associated in a 
row.  <fieldset>'s would also be nice, but they're intended for 
groupings of form elements, and using them for each text input seems 
like a load of bloat.

I've been looking at many examples of "correct, semantic forms", but 
can't see anything like this out there.

TIA

---
Justin French
http://indent.com.au

*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
***************************************************** 


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________
CONFIDENTIALITY NOTICE
The information contained in this communication is confidential and may be legally 
privileged.  It is intended solely for the use of the individual or entity to whom it 
is addressed and others authorised to receive it.  If you are not the intended 
recipient you should not disclose, copy, distribute or take action on the contents of 
this information, except for the purpose of delivery to the addressee.  Any 
unauthorised use is strictly prohibited and may be unlawful.  If you have received 
this email in error please notify the sender by email immediately and delete the 
message from your computer.

ECOTEC Research & Consulting Limited
Registered in England No. 1650169 Registered Office:
Priestley House, 28-34 Albert Street, Birmingham, B4 7UD, UK
Tel: +44 (0)121 616 3600
http://www.ecotec.com
________________________________________________________________________
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************

Reply via email to