Webolution Designs

Aug 24 2016

Who are you?

When utilizing forms, it is helpful to use a combination of the ID and name attributes, I typically name and ID my form and nearly all of my form fields so it is easy to manage them programmatically. Here is an example:

Accessing via ID or Name

As you can see, I made both the names and IDs the same. The reason I do this is because sometimes you use the ID in JavaScript to grab a field and in form processing, the form object, which is accessed via the name attribute, is used.

To access a field by ID:

To access a field via the name attribute:

Either one is a valid access method, but with forms and their processing, the form object is typically easier and used more often.

Happy Coding!

Clay Hess

Leave a Reply

Your email address will not be published. Required fields are marked *