Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-3182

radiobutton other clause is broken.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 1.9.12, 2.0, 2.1
    • Component/s: Module: Questionnaire
    • Labels:
      None
    • Workaround:
      Hide

      patch as:
      diff /mod/questionnaire/locallib.php questionnaire/locallib.php
      1107c1107
      < $pos = strpos($resp, 'other=');

      > $pos = strpos($resp, 'other_');
      1124c1124
      < $pos = strpos($resp, 'other=');

      > $pos = strpos($resp, 'other_');
      3067c3067

      Show
      patch as: diff /mod/questionnaire/locallib.php questionnaire/locallib.php 1107c1107 < $pos = strpos($resp, 'other='); — > $pos = strpos($resp, 'other_'); 1124c1124 < $pos = strpos($resp, 'other='); — > $pos = strpos($resp, 'other_'); 3067c3067
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE, MOODLE_21_STABLE

      Description

      checkbox in questionaire on moodle 2

      If other and all are ticked, to many entries.
      If other only then error. Think is typo as below. seems to work with these patches.

      diff mod/questionnaire/locallib.php questionnaire/locallib.php
      1107c1107
      < $pos = strpos($resp, 'other=');

      > $pos = strpos($resp, 'other_');
      1124c1124
      < $pos = strpos($resp, 'other=');

      > $pos = strpos($resp, 'other_');
      3067c3067

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            rezeau Joseph Rézeau added a comment -

            @Frank,
            I do not see this problem. Are you sure you are using the latest Questionnaire version available for moodle 2 ?
            locallib.php line 1107 reads:
            $pos = strpos($resp, 'other_');

            Joseph

            Show
            rezeau Joseph Rézeau added a comment - @Frank, I do not see this problem. Are you sure you are using the latest Questionnaire version available for moodle 2 ? locallib.php line 1107 reads: $pos = strpos($resp, 'other_'); Joseph
            Hide
            fsainsbu Frank Sainsbury added a comment - - edited

            My apologies, I have not made myself clear:
            The strpos is meant I believe, to be matching other= in the text from the responses. (I think the other_ is related to something in the javascript blocks.)
            ie To work the line should read other= not other_

            I tested this on my system and it corrected the inability to answer all and give an other response. (This was failing for me)

            The only clue in what I wrote is that one of the questionaires is in mod and one is not. I believe we are looking at the same version. Sorry again.

            Show
            fsainsbu Frank Sainsbury added a comment - - edited My apologies, I have not made myself clear: The strpos is meant I believe, to be matching other= in the text from the responses. (I think the other_ is related to something in the javascript blocks.) ie To work the line should read other= not other_ I tested this on my system and it corrected the inability to answer all and give an other response. (This was failing for me) The only clue in what I wrote is that one of the questionaires is in mod and one is not. I believe we are looking at the same version. Sorry again.
            Hide
            rezeau Joseph Rézeau added a comment -

            @Frank, I still do not understand your problem.

            1.- When you say "If other and all are ticked, to many entries." I suppose that means you get an error message saying something like "Too many entries"? If not, what is the exact error message you are getting?

            2.- When you say "If other only then error." If I tick the "other" box only, then I get an error message. Which error message do you get?

            3.- Have you read the online documentation explaining the use of the !other setting, at: http://docs.moodle.org/20/en/mod/questionnaire/questions#Check_Boxes

            4.- Could you please in your reply to this comment put the complete Question text and possible answers of the check boxes question that poses problem on your moodle site?

            5.- The following question (taken from the online documentation) works fine on my moodle 2.0 and 2.1 questionnaire module:

            Question text: What are your favorite hobbies?

            Possible answers:

            Watching TV
            Dancing
            Computing
            !other=Another hobby:

            6.- Please post question texts, screenshots, anything that clearly shows the problem. Oh, and also which type of database you are using (mySql, postGres, etc).

            Joseph

            Show
            rezeau Joseph Rézeau added a comment - @Frank, I still do not understand your problem. 1.- When you say "If other and all are ticked, to many entries." I suppose that means you get an error message saying something like "Too many entries"? If not, what is the exact error message you are getting? 2.- When you say "If other only then error." If I tick the "other" box only, then I get an error message. Which error message do you get? 3.- Have you read the online documentation explaining the use of the !other setting, at: http://docs.moodle.org/20/en/mod/questionnaire/questions#Check_Boxes 4.- Could you please in your reply to this comment put the complete Question text and possible answers of the check boxes question that poses problem on your moodle site? 5.- The following question (taken from the online documentation) works fine on my moodle 2.0 and 2.1 questionnaire module: Question text: What are your favorite hobbies? Possible answers: Watching TV Dancing Computing !other=Another hobby: 6.- Please post question texts, screenshots, anything that clearly shows the problem. Oh, and also which type of database you are using (mySql, postGres, etc). Joseph
            Hide
            rezeau Joseph Rézeau added a comment -

            Sorry about the confusion, Frank, but in your original post the title was about "radio button" and in your description you talked about checkbox. Those are 2 different question types in Questionnaire, hence the confusion that ensued.

            I can now confirm that there is a bug with the radio button question type when used in conjunction with the !other parameter. I will investigate and report here...

            Joseph

            Show
            rezeau Joseph Rézeau added a comment - Sorry about the confusion, Frank, but in your original post the title was about "radio button" and in your description you talked about checkbox. Those are 2 different question types in Questionnaire, hence the confusion that ensued. I can now confirm that there is a bug with the radio button question type when used in conjunction with the !other parameter. I will investigate and report here... Joseph
            Hide
            rezeau Joseph Rézeau added a comment -

            fixed in all versions from 1.9 to HEAD (2.2)

            Show
            rezeau Joseph Rézeau added a comment - fixed in all versions from 1.9 to HEAD (2.2)
            Hide
            fsainsbu Frank Sainsbury added a comment -

            Thanks Joseph, that is great

            Show
            fsainsbu Frank Sainsbury added a comment - Thanks Joseph, that is great

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  24/Nov/10