currently, the answer options when rendering a question (multichoice_render_question_form()),
a formatted like <label><div><p>text</p></div></label>
with the set to display: inline.
Firefox doesnt like this much, and as add1sun pointed out, its not legal html. Adding a display: inline to the div
doesn't seem to resolve the issues either. But using a <span>...</span>
seems to work fine,
and as long as the inner <p>
is still styled inline it should be valid html.
works in Firefox 2 and Opera 9 on windows. Doesn't work in IE6, but I think thats a different problem
(IE6 seems to require a "for" attribute on the label tag, even when its enclosing the input tag).
Comment | File | Size | Author |
---|---|---|---|
#12 | multichoice_labels_patch_2.patch | 1.9 KB | kylebrowning |
#4 | quiz_multichoice_labels.patch | 1.26 KB | westwesterson |
#3 | multichoice_labels_patch_1.patch | 1.29 KB | kylebrowning |
#2 | multichoice_labels_patch_1.patch | 1.29 KB | kylebrowning |
multichoice_labels_patch_0.txt | 1.27 KB | kscheirer |
Comments
Comment #1
kscheirerComment #2
kylebrowning CreditAttribution: kylebrowning commentedPatch didnt work against HEAD revision, problem was invalid line numbers, fixed, heres a new patch
Comment #3
kylebrowning CreditAttribution: kylebrowning commentedPatch didnt work against HEAD revision, problem was invalid line numbers, fixed, heres a new patch
Comment #4
westwesterson CreditAttribution: westwesterson commentedPatch was still using an old version of quiz, updated against current. ocyrus, you might be using an old version of quiz to do your patches. There have been substantial code changes since version 1.41 of multichoice.module, which your patch references.
Comment #5
Senpai CreditAttribution: Senpai commentedApplied correctly, and tested correctly. I would like to raise a concern here that involves the HTML output of multichoice.module.
Here is the HTML that's being output AFTER this current patch is applied:
Why, oh why do we have paragraphs inside of inline-classed spans inside of label tags? If we were to remove these <p> tags, it would clean up the entire structure of a quiz, and allow for even more complex theming than is currently possible.
These aren't paragraphs. They are labels. Let's not treat them as labels-with-a-paragraph-inside-it. Leaving this the way it is will result in themers creating a class for their answer-label text, and then another one for the paragraphs inside their answer-label text that refuse to pay attention to the first, and correct, CSS class.
Karl, Chip agrees with me that these p tags should go away. I did a search through all the theme functions in both the multichoice.module and the quiz.module, and I can't find what's generating this tag. I'd be more than happy to remove the offending tags, or even build a theme function for this if needed.
Comment #6
kylebrowning CreditAttribution: kylebrowning commentedDid we decide on what we wanted to do about this.
Comment #7
Senpai CreditAttribution: Senpai commentedI pinged kscheirer on this one. I want this <p> tag to go away, so if there are no objections from Westerson or Karl, I'd like to submit a patch that makes this happen.
Comment #8
westwesterson CreditAttribution: westwesterson commentedno objections here.
Comment #9
kscheirercheck_markup() is the culprit here. the question body and each of the answers is run through
check_markup($node->body, $node->format, FALSE)
orcheck_markup($answer['answer'], $node->format, FALSE)
, which returns the text with an enclosing<p>...</p>
.this looks to be pretty original quiz module code, so perhaps the way we are calling check_markup is no longer correct? This certainly does seem like an unintended side-effect.
Comment #10
Senpai CreditAttribution: Senpai commentedYeah, I was just starting to run down the check_markup() as the culprit when you posted this. I believe that the input filter which does line-break conversion is partly to blame here as well. I'll be doing some research to see if we can re-work the check_markup somehow.
Comment #11
Senpai CreditAttribution: Senpai commentedOk, it looks like we could simply use check_plain here, rather than trying to invoke an input filter. Since we're creating multichoice questions here, every question is going to be nothing but labels for radio buttons or checkboxes. I don't see any need for anyone to ever need html or more than one paragraph in a label for a multichoice question.
Can we just re-write this to use check_plain instead of leveraging the $node->body's input filtering system into this teeny tiny space?
Comment #12
kylebrowning CreditAttribution: kylebrowning commentedHeres a patch that solves this issue.
Our only question is if we mind that the multichoice labels are ran against check_plain
Comment #13
westwesterson CreditAttribution: westwesterson commentedA use case for check markup is picture questions. Right now people can use html to insert images and audio into their content. If that means that we have to live with a <p> which is generated by an input filter then so-be-it. Can we not work with the assumption that we don't know what kind of markup is contained for questions and answers?
Even if this is ugly code wise, i think this is a feature that we wish to still have.
What do you think?
Comment #14
kylebrowning CreditAttribution: kylebrowning commentedI am in agreement that the
doesnt bother me at all. And that we shouldnt get rid of Drupal Functionality like this patch does. However this is done via label of a multichoice question. Can the Labels to radio boxes/checkboxes be an image?
Comment #15
westwesterson CreditAttribution: westwesterson commentedno, but html markup such as the 'strong' tag, and links to pop up windows can still be used. i can imagine someone wanting to be able to use the strong tag or colors in their answers.
Comment #16
kylebrowning CreditAttribution: kylebrowning commentedThen I think check_markup is fine with me.
Comment #17
westwesterson CreditAttribution: westwesterson commentedSince #4 has been agreed upon, I am applying patch from #4.
Comment #18
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.