Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9094445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T23:21:05+00:00 2026-06-16T23:21:05+00:00

This is a best practices question. I was perusing the Code Review StackExchage site,

  • 0

This is a “best practices” question. I was perusing the Code Review StackExchage site, and I saw this thread. In it, Joseph Silber makes the suggestion of using bracket notation and eschewing IDs entirely for a form with multiple identically-structured rows of form inputs.

In the books I’ve read on web design/development, I’ve never seen this strategy used. Is using bracket notation and wrapping input elements within label tags, as well as not using id tags in form inputs a good idea? Perhaps there something about Javascript/JQuery that makes this approach advantageous?

I wanted to ask Joseph about it directly, but I don’t have any reputation on the site yet so I couldn’t even comment. However, I’m interested in seeing the community-wide perspective on this, because searching for things like “HTML5 bracket notation” and “HTML5 arraylike notation” isn’t turning up anything definitive for me so far.

Here’s a summary of the above question with some example code borrowed from the linked question:

Why use this:

<label>Comment:
  <input type="text" name="comment[]" width="50" />
</label>

instead of this:

<label for="comment-0">Comment: </label>
<input type="text" id="comment-0" name="comment-0" width="50" />

in a form with multiple rows of the same inputs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T23:21:06+00:00Added an answer on June 16, 2026 at 11:21 pm

    Sticking [] on the end of an input name will cause some server side form processing libraries to present the data as an array. Some other form processors don’t need the special syntax. Your choice will largely depend on your desire to be compatible with the former kind vs having more complicated names and not being able to access the elements via dot-notation in JS.

    Using child elements instead of for attributes will:

    • Save you from having to generate unique ids (especially useful if similar forms can appear on a single page)
    • Limit your styling choices
    • Be compatible with fewer browsers (I think the only loss is old versions of IE, which is no big loss).

    So there are pros and cons there and you have to decide what it right for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Advice: The code works fine, this question is about best practices of doing it.
This is probably more of a best practices question than a true code question.
This is a best practices question Let say, I have a class object, like
This is really just a best practices question... I find that When developing an
This is basically a 'best practices' question. Struts 1 forms have getters and setters
I think this is just a Best Practices question, but I was wondering if
Yesterday, I asked this question regarding best practices for a simple information retrieval system
This may be a question about convention, best practices and/or personal preferences: So I'm
I know this is a subjective question, but I'm always curious about best-practices in
This is more of an architecture/best practices question than anything else, so please feel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.