I like shot #1 , the top one. It seems less redundant.
Also I would consider this to be an HTML table. The data has clear semantic and co-relational meaning, so that dictates what the mark-up should be.
You can style it just about anyway; this is no different than a star rating system. You could cop the stylesheet any such rating sys and just change the CSS the selectors to target the child elements of TDs.
[FONT=verdana]Personally, I would keep it as simple as possible. For that reason, I would suggest you stick with just one question, or two at the most. Anything more than that means more effort on the part of the visitor, and so more chance that they won’t bother to reply.
The one thing that no one has picked up on is that if I go with Choice #1, then my Radio Buttons don’t have a <LABEL> associated with each one.
I know there are some people around here that would shoot that design down immediately!!!
While I agree that you should almost always use Labels, in such a repetitive and tabular case as this, I don’t think it is an issue, although I’m sure Accessibility people will scream bloody-murder at that comment…
Like most things, sometimes you have to compromise, but feel free to pipe in…
The one thing that no one has picked up on is that if I go with Choice #1, then my Radio Buttons don’t have a <LABEL> associated with each one.
#1 The label could be hidden.
AND #2 Because of the NATURE OF RADIO BUTTONS ( they are linked in a group by similar name), the label points back to the rlated QUESTION and not to the ‘name’ attribute of each button. In other word think of the label as labeling a button GROUP.
My best guess is that the HTML Table provides the proper semantic structure of linking each Question in the first column to the corresponding Radio Buttons in the other columns all of which are in the same respective row.
OK…
I thought about it from a different angle. My previous though processed focused on NOT REPEATING info. The thing , if we reconsider what the WC# actually MEANS, is that each button must have its own UNIQUE label. Now from a human point of view this is redundant and thus semantically it could be condensed to tabular format. But since we MUST give EACH INPUT TAG a label… this is what we end up with…
As I said above, it seems to me that since the Radio Buttons are in an HTML Table, that they should be okay without Labels. (Although I’m sure Accessibility people will tear me to shreds for saying that!)
Thank you for the two code samples above.
Like you, I agree that the first one seemed awfully verbose.
And I didn’t care for the second one since it lost the columns, rows, and borders that a table brings to organizing the data. (Although I’m sure if I spent enough time, I could improve it to my liking.)
Also added an ID to every col? ( remember CSS identifiers carry no semantic meaning in the mark up)
I just did that out of habit since I think I will need those as “hooks” for my PHP, but I could be wrong?! :-/
I just did that out of habit since I think I will need those as “hooks” for my PHP, but I could be wrong?!
PHP needs hooks?
Aside from what I have mentioned (labels and ID overkill) only that if you are going to numerate the name attribute… be sure it matches the actual readable name. Otherwise it might be more graceful to just use ‘responseToQuestion’ the array will be crated sequentially automatically , starting from 0.
Also, you could use CSS’s :before pseudo element and a counter to add the “#.)” ( incidentally, that should read either “#.” or “#)” to the question fields but that’s just shining the code.
Except I am trying to build my Form so it populates the Form based on a “Survey Map” from my database.
So Article #1 might have Questions 1, 3, 5, 7 whereas Article #2 might have Questions 2, 4, 6, 8 so I need to assign a “question_id” based on what comes from the database and not leave it up to what you are saying, if I understand your suggestion.
All in all, it sounds like my Questions pass the HTML/CSS test, though?
So Article #1 might have Questions 1, 3, 5, 7 whereas Article #2 might have Questions 2, 4, 6, 8 so I need to assign a “question_id” based on what comes from the database and not leave it up to what you are saying, if I understand your suggestion.
OK I get it now. You’re using the array key to serve as a marker for the question ID in the DB. And, yes it seems to makes semantic sense.