Drop down lists

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

Hi, I'm trying to add a drop down link list to a table in an xhtml 1.0 Strict doctype. I need it to be as simple as possible as there are about 90 rows to the table and each row requires a drop down list in one of the columns.

I've tried using the following code in the correct rows tags:

1
2
3 text1
4 text2
5 text3
6
7

It works in practice but does not validate, producing the following 2 errors:

1. Line 1: required attribute "action" not specified.
2. Line 2: document type does not allow element "select" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

Any ideas what the problem is or if there's a better way of doing this? I guess this is just not in an xhtml fecognised format but am not sure.

Thanks in advance

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

It's ok i've sorted it now. I just changed the Doc Type to xhtml Transitional and added a black 'action' attribute to the tag. Laughing out loud

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

Sorry I didn't see this earlier, but you can change your DOCTYPE back to strict, and change your code to read:

<form action="whatever.html">
<fieldset>
<select>
<option value="link 1">text1</option>
<option value="link 2">text2</option>
<option value="link 3">text3</option>
</select>
</fieldset>
</form>

It's as simple as that dude. You might as well just put the current page into the form action, some poor browser might get confused otherwise. Not sure if you need a method="post" in there too to validate? Smiling

The fieldset tag is a way of grouping a bunch of form elements, you can get rid of the border it creates using 'border' in CSS.

a Padded Cell our articles site!

aka Rohan's picture

He has: 200 posts

Joined: Feb 2006

Ah cracking, nice one dude, problem solved. All validating fine in strict without the method="post". Thanks alot. Smiling

He has: 113 posts

Joined: Jul 2005

you can leave the action tag blank. It will still validate just as long as it exists.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

And for those who need a remind, if the action field is blank (action=""), then it just refers back to the page the data was sent from.

He has: 1,758 posts

Joined: Jul 2002

Renegade;211556 wrote: And for those who need a remind, if the action field is blank (action=""), then it just refers back to the page the data was sent from.

True... but it's bad form. Really you should be explicit and specify the page you want it to refer to just in case...

Andy

He has: 113 posts

Joined: Jul 2005

Good call. I should of put that Smiling

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Yes, absolutely, but, just thought I'd include it as a bit of an FYI. Have quite a few people ask me in the past Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.