View Full Version : Can <select> elements be outside of the <form> element?

Aug 3rd, 2010, 01:39 AM
This is probably common sense, but I blatantly don't know a lot of HTML rules. So if I place <select> elements out of <form> elements, will I be violating HTML standards? If it is, is there an alternative to using <select> elements?

Aug 3rd, 2010, 02:38 AM
No, <select> doesn't have to be inside a form. Some sites (jsrdirect.com (http://jsrdirect.com), where I like to buy my shirts) use dropdown menus for links, which is one way they can be used outside of their most common form use.

Aug 3rd, 2010, 04:52 PM
No, <select> doesn't have to be inside a form.

Wow, that’s news to me. I could have sworn it wasn’t allowed. But anyway, apart from that the question is: What does a select element do by nature (that means without the help of JavaScript or a form’s submit button)?

Is the answer “nothing”? Well, then it is certainly not correct to use it outside of a form, semantics wise.

Aug 3rd, 2010, 08:31 PM
It was intended for forms, but I don't think it's actually bad syntax to use it outside. Maybe it is just with Javascript, but I have seen a lot of sites that use it outside forms. Correct me if I'm wrong.

Okay, I'll correct myself. You're right, I think it is improper to use it outside a form. Sorry for that.

Major Payne
Aug 3rd, 2010, 08:43 PM
As far as I know, the select tags are suppose to be placed between the form tags with the proper syntax. It may work without them, but it is not syntactically correct. Leaving out the form's action="" even if there is no action will get it flagged by validator. Maybe HTML 5 will address this better.