Forms, forms and more forms
Okay, so I thought I knew what I needed to know about web forms, but… well I was wrong. As I posted last week, there are some form elements and attributes that I had never heard of before. Today, I found this nice explanation of what the difference is between the id attribute and the name attribute and how they are used in data gathering form elements. In theory, the two are used similarly. Although, the id attribute can also be used like the class attribute when using CSS. However, with forms id has a purpose I didn't realize. In addition, how the form behaves is different if you include only one or the other.
Here's the deal in short. If you don't include the name attribute then your form data doesn't get submitted. Most of use know this because we have had it happen. However, if you don't include the id attribute the <label> for that field doesn't work the way it should. ie. you can't click on the <label> and get placed in the correct field box.
So if you want things to work they way they are supposed to you need to use both the name AND id attributes for your form elements. Who knew?
This answers a question I have been wondering using Macromedia Dreamweaver. Why does Dreamweaver included both the id and name attibutes in every form field when you use the WYSIWYG mode to create forms? To me it seems redundant. However, it has a purpose after all.