Moodle

Checkbox options cannot be searched

Details

  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE, MOODLE_21_STABLE

Description

At a field of type "checkbox", all its checked items are shown all together as a single option in the advanced search page, as shown in the attached screenshot. The same problem existed recently for multiselect menu fields, which has been fixed by Petr, so the solution is already known. Only sad that it seems to be too late to find into 1.9.1...

  1. field.class.php
    08/Feb/09 11:56 PM
    8 kB
    David Bogner
  2. field.class.php
    28/Aug/08 3:05 AM
    6 kB
    Felipe
  3. MDL-14818_head.patch
    24/Mar/09 4:07 PM
    6 kB
    Dongsheng Cai
  1. Incorrectly_created_dropdown_menu.png
    10 kB
    13/May/08 11:47 PM

Activity

Hide
Robert Allerstorfer added a comment -

Petr,

you have already fixed the same bug at the multiselect menu, so I think it would be the easiest for us if you apply these fixes here, too.

Show
Robert Allerstorfer added a comment - Petr, you have already fixed the same bug at the multiselect menu, so I think it would be the easiest for us if you apply these fixes here, too.
Hide
Petr Škoda (skodak) added a comment -

if I find time to do that, sure

Show
Petr Škoda (skodak) added a comment - if I find time to do that, sure
Hide
Felipe added a comment -

I applied here Petr Skoda's solution/code to multiselect menus problem (credits to him), and made some changes in display_search_field(). Now it's able to deal with checkboxes.

Show
Felipe added a comment - I applied here Petr Skoda's solution/code to multiselect menus problem (credits to him), and made some changes in display_search_field(). Now it's able to deal with checkboxes.
Hide
Felipe added a comment -

btw, can anyone test the file for me, to make sure it really works?

Show
Felipe added a comment - btw, can anyone test the file for me, to make sure it really works?
Hide
Peter Sereinigg added a comment -

Hi Petr,
E-Lisa Academy in Austria, would need that fixed as soon as possible, any reason, not to add it to a weekly 1.9.4+?
regards Peter

Show
Peter Sereinigg added a comment - Hi Petr, E-Lisa Academy in Austria, would need that fixed as soon as possible, any reason, not to add it to a weekly 1.9.4+? regards Peter
Hide
David Bogner added a comment -

Hi,

I just tested the patch. Now the advanced search form is correctly displayed, but the search in a Checkbox field does still not work.
If I have three terms let us assume apple banana and carrot as checkbox items, and I have a database entry with banana and apple selected, and I search for apple, no entry will be found.

I think it's because the search is trying to match the exact phrase but not just one item.

And still one inconvenience: I can only search for one itm in the advanced search like for apple, but not for apple and banana. So instead of a drop down menu search a checkbox search possibility would be preferable.

Regards David

Show
David Bogner added a comment - Hi, I just tested the patch. Now the advanced search form is correctly displayed, but the search in a Checkbox field does still not work. If I have three terms let us assume apple banana and carrot as checkbox items, and I have a database entry with banana and apple selected, and I search for apple, no entry will be found. I think it's because the search is trying to match the exact phrase but not just one item. And still one inconvenience: I can only search for one itm in the advanced search like for apple, but not for apple and banana. So instead of a drop down menu search a checkbox search possibility would be preferable. Regards David
Hide
David Bogner added a comment -

Fixed and tested the search.
That's changed:
Search options displayed as checkboxes (former drop down menu)
Search works

Show
David Bogner added a comment - Fixed and tested the search. That's changed: Search options displayed as checkboxes (former drop down menu) Search works
Hide
David Bogner added a comment -

Hi,

just fixed this issue. Tested in on my server. Please include in Weekly release soon (after some more testing)

Thanks

Show
David Bogner added a comment - Hi, just fixed this issue. Tested in on my server. Please include in Weekly release soon (after some more testing) Thanks
Hide
Hannes Fuchs added a comment -

We are running the patched version from David Bogner at www.edumoodle.at and it works.

Show
Hannes Fuchs added a comment - We are running the patched version from David Bogner at www.edumoodle.at and it works.
Hide
Martin Dougiamas added a comment -

Dongsheng, could you please review this patch one more time and check it in?

Show
Martin Dougiamas added a comment - Dongsheng, could you please review this patch one more time and check it in?
Hide
Eloy Lafuente (stronk7) added a comment -

Hi I was just reviewing this ... and noticed one "strange" behaviour when searching, BOTH in multiselect menu and in checkboxes fields, and it's that only "used" values are showed to be searched.

So, if I've one multiselect menu (or one checkbox) field with values "one", "two", "three" and I only have "ones" and "twos" selected in the records, then only "one" and "two" are showed in the search template.

IMO it would be more correct to show all the possible values (from field definition), or perhaps that's one on-purpose feature (get them from current records).

Just that. I've been playing with the patched field and works ok in searches (simple, multiple...). Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi I was just reviewing this ... and noticed one "strange" behaviour when searching, BOTH in multiselect menu and in checkboxes fields, and it's that only "used" values are showed to be searched. So, if I've one multiselect menu (or one checkbox) field with values "one", "two", "three" and I only have "ones" and "twos" selected in the records, then only "one" and "two" are showed in the search template. IMO it would be more correct to show all the possible values (from field definition), or perhaps that's one on-purpose feature (get them from current records). Just that. I've been playing with the patched field and works ok in searches (simple, multiple...). Ciao
Hide
Dongsheng Cai added a comment -

Eloy, yes, it is a on-purpose feature, I agree with you, all the possible values should be displayed here

Show
Dongsheng Cai added a comment - Eloy, yes, it is a on-purpose feature, I agree with you, all the possible values should be displayed here
Hide
Dongsheng Cai added a comment -

This is a patch against moodle 2.0

Show
Dongsheng Cai added a comment - This is a patch against moodle 2.0
Hide
Petr Škoda (skodak) added a comment -

I might have found a problem:

1/ add template with checkbox
2/ add one record with checked
3/ add second value with unchecked
4/ search for checked - 1 displayed as result
5/ search for unchecked - all returned, search ignored - I expected to get 1 entry as result, instead it looks like my empty checkbox value was completely ignored

Show
Petr Škoda (skodak) added a comment - I might have found a problem: 1/ add template with checkbox 2/ add one record with checked 3/ add second value with unchecked 4/ search for checked - 1 displayed as result 5/ search for unchecked - all returned, search ignored - I expected to get 1 entry as result, instead it looks like my empty checkbox value was completely ignored
Hide
David Bogner added a comment -

the problem Petr mentioned does not occur if only "used" values are showed to be searched.
So why search for values, that can't be found. There is no inconvenience about that. (I am a havy database user and found that feature useful and not "strange" as previously mentioned)
Try it out under following link and you will see, the problem Petr described does not happen:
http://www.edumoodle.at/edulab/mod/data/view.php?id=6451

Show
David Bogner added a comment - the problem Petr mentioned does not occur if only "used" values are showed to be searched. So why search for values, that can't be found. There is no inconvenience about that. (I am a havy database user and found that feature useful and not "strange" as previously mentioned) Try it out under following link and you will see, the problem Petr described does not happen: http://www.edumoodle.at/edulab/mod/data/view.php?id=6451
Hide
Petr Škoda (skodak) added a comment -

I do not think so, in my case both "checked" and "unchecked" are used, so I would suppose I can search for all checked but also for all unchecked, should I?

Show
Petr Škoda (skodak) added a comment - I do not think so, in my case both "checked" and "unchecked" are used, so I would suppose I can search for all checked but also for all unchecked, should I?
Hide
Robert Allerstorfer added a comment -

The way currently multi selection menus work is fine. It makes no sense to offer searching in fields that are known to be empty. I think the checkbox search should work the same way - with a selected option being equivalent to a ticked checkbox. Thus, unticked checkboxes should not be taken into consideration for search at all.

Show
Robert Allerstorfer added a comment - The way currently multi selection menus work is fine. It makes no sense to offer searching in fields that are known to be empty. I think the checkbox search should work the same way - with a selected option being equivalent to a ticked checkbox. Thus, unticked checkboxes should not be taken into consideration for search at all.
Hide
David Bogner added a comment -

I think searching for "unchecked" is not possible. Assuming you have ceckbox options "apple" and "pear". So you can have pear and apple or only pear or only apple, or nothing. Either you find an "apple" or there is no "apple" in the database. The database entry is not "no apple" or "apple unchecked" but just empty or just pear. So searching for unchecked makes no sense.
Perhaps I don't understand the problem?

Show
David Bogner added a comment - I think searching for "unchecked" is not possible. Assuming you have ceckbox options "apple" and "pear". So you can have pear and apple or only pear or only apple, or nothing. Either you find an "apple" or there is no "apple" in the database. The database entry is not "no apple" or "apple unchecked" but just empty or just pear. So searching for unchecked makes no sense. Perhaps I don't understand the problem?
Hide
Petr Škoda (skodak) added a comment -

we are very close to release, delaying the decision a bit

Show
Petr Škoda (skodak) added a comment - we are very close to release, delaying the decision a bit
Hide
Petr Škoda (skodak) added a comment -

next release is getting closer again, sorry

Show
Petr Škoda (skodak) added a comment - next release is getting closer again, sorry
Hide
Dongsheng Cai added a comment -

This looks like a highly demanded feature, we probably should pick this.

Show
Dongsheng Cai added a comment - This looks like a highly demanded feature, we probably should pick this.

Dates

  • Created:
    Updated: