Skip to content

Commit

Permalink
MDL-42505 - Feedback plugin: Inappropriate use of fieldset tags aroun…
Browse files Browse the repository at this point in the history
…d form and cancel button

Changes:
* Removed the fieldset HTML tags around the Cancel button at the bottom of the form.
* Removed the fieldset HTML tags around the whole form.
* Added missing fieldset tags around groups of radio buttons and checkboxes.
* Removed unordered list wrapping dropdown lists.
* Removed duplicate label for dropdown lists.

Modified Files:
* mod/feedback/complete.php
* mod/feedback/complete_guest.php
* mod/feedback/item/multichoice/lib.php
* mod/feedback/item/multichoicerated/lib.php

Signed-off-by: Michael Milette <michael.milette@instruxmedia.com>
  • Loading branch information
Michael Milette authored and marinaglancy committed Feb 11, 2014
1 parent 58ce512 commit 761a10f
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
4 changes: 0 additions & 4 deletions mod/feedback/complete.php
Expand Up @@ -418,7 +418,6 @@
if (is_array($feedbackitems)) {
echo $OUTPUT->box_start('feedback_form');
echo '<form action="complete.php" method="post" onsubmit=" ">';
echo '<fieldset>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo $OUTPUT->box_start('feedback_anonymousinfo');
switch ($feedback->anonymous) {
Expand Down Expand Up @@ -547,7 +546,6 @@
echo '<input name="savevalues" type="submit" '.$inputvalue.' />';
}

echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();

Expand All @@ -562,11 +560,9 @@
}
}
echo '<form '.$action.' method="post" onsubmit=" ">';
echo '<fieldset>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="courseid" value="'. $courseid . '" />';
echo '<button type="submit">'.get_string('cancel').'</button>';
echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();
$SESSION->feedback->is_started = true;
Expand Down
4 changes: 0 additions & 4 deletions mod/feedback/complete_guest.php
Expand Up @@ -378,7 +378,6 @@
if (is_array($feedbackitems)) {
echo $OUTPUT->box_start('feedback_form');
echo '<form action="complete_guest.php" method="post" onsubmit=" ">';
echo '<fieldset>';
echo '<input type="hidden" name="anonymous" value="0" />';
$inputvalue = 'value="'.FEEDBACK_ANONYMOUS_YES.'"';
echo '<input type="hidden" name="anonymous_response" '.$inputvalue.' />';
Expand Down Expand Up @@ -493,7 +492,6 @@
echo '<input name="savevalues" type="submit" '.$inputvalue.' />';
}

echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();

Expand All @@ -508,11 +506,9 @@
}
}
echo '<form '.$action.' method="post" onsubmit=" ">';
echo '<fieldset>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="courseid" value="'. $courseid . '" />';
echo '<button type="submit">'.get_string('cancel').'</button>';
echo '</fieldset>';
echo '</form>';
echo $OUTPUT->box_end();
$SESSION->feedback->is_started = true;
Expand Down
30 changes: 23 additions & 7 deletions mod/feedback/item/multichoice/lib.php
Expand Up @@ -337,7 +337,12 @@ public function print_item_preview($item) {
echo '<div class="feedback_item_presentation_'.$align.'">';
$index = 1;
$checked = '';
echo '<ul>';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '<fieldset>';
echo '<ul>';
}

if ($info->horizontal) {
$hv = 'h';
} else {
Expand Down Expand Up @@ -376,7 +381,11 @@ public function print_item_preview($item) {
$this->print_item_dropdown($presentation, $item, false, $info, $align);
break;
}
echo '</ul>';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '</ul>';
echo '</fieldset>';
}
echo '</div>';
}

Expand Down Expand Up @@ -438,7 +447,11 @@ public function print_item_complete($item, $value = null, $highlightrequire = fa
//print the presentation
echo '<div class="feedback_item_presentation_'.$align.$highlight.'">';

echo '<ul>';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '<fieldset>';
echo '<ul>';
}
if ($info->horizontal) {
$hv = 'h';
} else {
Expand Down Expand Up @@ -483,7 +496,11 @@ public function print_item_complete($item, $value = null, $highlightrequire = fa
$this->print_item_dropdown($presentation, $item, $value, $info, $align);
break;
}
echo '</ul>';
if ($info->subtype == 'r' || $info->subtype == 'c') {
// if (r)adio buttons or (c)heckboxes
echo '</ul>';
echo '</fieldset>';
}
echo '</div>';
}

Expand Down Expand Up @@ -774,8 +791,7 @@ private function print_item_dropdown($presentation, $item, $value, $info, $align
}

?>
<li class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
<label class="accesshide" for="<?php echo $item->typ .'_' . $item->id;?>"><?php echo $item->name; ?></label>
<div class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
<select id="<?php echo $item->typ .'_' . $item->id;?>" name="<?php echo $item->typ .'_' . $item->id;?>[]" size="1">
<option value="0">&nbsp;</option>
<?php
Expand All @@ -799,7 +815,7 @@ private function print_item_dropdown($presentation, $item, $value, $info, $align
}
?>
</select>
</li>
</div>
<?php
}

Expand Down
9 changes: 4 additions & 5 deletions mod/feedback/item/multichoicerated/lib.php
Expand Up @@ -520,6 +520,7 @@ private function print_item_radio($item, $value, $info, $align, $showrating, $li
} else {
$hv = 'v';
}
echo '<fieldset>';
echo '<ul>';
if (!$this->hidenoselect($item)) {
?>
Expand Down Expand Up @@ -576,6 +577,7 @@ private function print_item_radio($item, $value, $info, $align, $showrating, $li
$index++;
}
echo '</ul>';
echo '</fieldset>';
}

private function print_item_dropdown($item, $value, $info, $align, $showrating, $lines) {
Expand All @@ -584,10 +586,8 @@ private function print_item_dropdown($item, $value, $info, $align, $showrating,
} else {
$hv = 'v';
}
echo '<ul>';
?>
<li class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
<label class="accesshide" for="<?php echo $item->typ.'_'.$item->id;?>"><?php echo $item->name; ?></label>
<div class="feedback_item_select_<?php echo $hv.'_'.$align;?>">
<select id="<?php echo $item->typ.'_'.$item->id;?>" name="<?php echo $item->typ.'_'.$item->id;?>">
<option value="0">&nbsp;</option>
<?php
Expand All @@ -613,9 +613,8 @@ private function print_item_dropdown($item, $value, $info, $align, $showrating,
}
?>
</select>
</li>
</div>
<?php
echo '</ul>';
}

public function prepare_presentation_values($linesep1,
Expand Down
18 changes: 12 additions & 6 deletions mod/feedback/styles.css
Expand Up @@ -47,24 +47,30 @@ div.feedback_item_commands_right {

li.feedback_item_check_h_left,
li.feedback_item_check_h_right,
li.feedback_item_select_h_left,
li.feedback_item_select_h_right,
li.feedback_item_radio_h_left,
li.feedback_item_radio_h_right{
li.feedback_item_radio_h_right {
list-style-type:none;
display:inline;
}

div.feedback_item_select_h_left,
div.feedback_item_select_h_right {
display:block;
}

li.feedback_item_check_v_left,
li.feedback_item_check_v_right,
li.feedback_item_select_v_left,
li.feedback_item_select_v_right,
li.feedback_item_radio_v_left,
li.feedback_item_radio_v_right{
li.feedback_item_radio_v_right {
list-style-type:none;
display:block;
}

div.feedback_item_select_v_left,
div.feedback_item_select_v_right {
display:block;
}

div.feedback_items label{
display: inline;
}
Expand Down

0 comments on commit 761a10f

Please sign in to comment.