justuptime.com - monitor your servers & websites

Drop down lists

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.
Monkeyboy's picture

He has: 199 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

J's World Welcome to my world

Monkeyboy's picture

He has: 199 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

J's World Welcome to my world

JeevesBond's picture
Moderator

He has: 3,489 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!

Monkeyboy's picture

He has: 199 posts

Joined: Feb 2006

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

J's World Welcome to my world

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
Moderator

He has: 2,943 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.

Cheng Eu Chew - Renegade
Download:
- Mozilla, Firefox
- Opera
This post may contain peanut traces

andy206uk's picture
DeveloperModerator

He has: 1,742 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...

Andyk

Music Rants News and Reviews | My Photoblog | Blog of a Web Designer
Give a man a fish and you feed him for a day. Teach him to use the Net and he won't bother you for weeks.

He has: 113 posts

Joined: Jul 2005

Good call. I should of put that Smiling

Renegade's picture
Moderator

He has: 2,943 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

Cheng Eu Chew - Renegade
Download:
- Mozilla, Firefox
- Opera
This post may contain peanut traces