Results 1 to 8 of 8

Thread: How to do concatenation in html.

Threaded View

  1. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: How to do concatenation in html.

    The correct element to use is label:

    HTML Code:
    <form>
      <p>
        <label for="username-input">Username</label>
        <input type="text" name="username" id="username-input" />
      </p>
      <p>
        <label for="password-input">Password</label>
        <input type="password" name="password" id="password-input" />
      </p>
    </form>
    The for attribute of the label is an accessibility feature; it allows the user agent to match label and input element pairs and give them appropriate behaviours. (For example, in most browsers, the input element will gain focus if its associated label is clicked.)
    Note that the for attribute corresponds to the id of the input element, not its name; this is because multiple input controls can have the same name (such as radio buttons).

    For some examples of styling forms (including aligning labels), take a look at this article:
    Applying CSS to forms


    Quote Originally Posted by szlamany View Post
    Code:
    <div id="dlgLogin"> 
      <p><span class="acs-span-medium">Username </span><input type="text" id="acs-username" class="acs-edit-medium-text"/></p> 
      <p><span class="acs-span-medium">Password </span><input type="password" id="acs-password" class="acs-edit-medium-text"/></p> 
      <p><label id="acs-login-error"></label></p>
    </div>
    Strictly speaking, this is a misuse of the label markup. Instead, I would use the final paragraph element to display the error message, without a label element. In fact, I would go further and add the elements containing the error message at run-time, at the point when it needs to be shown.
    Last edited by penagate; Feb 5th, 2012 at 12:21 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width