Filter results checkbox

flyboeing 29 Oct, 2015
Hello all,

I have made a filter form. There are several fields for filter the data, including a checkbox. The rest of the form is working great, only the checkbox I can't manage to work.

I noticed that in the properties of the checkbox you can place a "static" value (for example 1, 0, or a text string). In my case I need the checkbox (if it is checked) to show all the records where that field is filled (with different values...).

How can I get it to work, so the checkbox checks which fields are filled with data (in 1 column) and which are empty?

Regards,
Ruud
GreyHead 30 Oct, 2015
Hi Ruud,

Sorry, I'm having trouble understanding the question. Are you saying that the checkbox returns a column name - or presumably several column names - and you want to return records where any of those columns has a value?

Bob
flyboeing 30 Oct, 2015
Hi Bob,

I have 2 checkboxes. The first on search the column "photo" (value: yes or no) and when the checkbox is checked it shows all the data where photo = yes.

For my second checkbox a have a column called "information". This column can't contain just 2 values (as in the photo column), but it contains a sentence. How can I let the checkbox only show the data (rows) where the "information" field is filled with data?
So the checkbox checks if the field is empty or contains text (doesn't matter what kind of text).

I hope the above clarified it a bit🙂

Regards,
Ruud
GreyHead 30 Oct, 2015
Hi Ruud,

Set the option for the second checkbox to . . . yes=some sentence of information and set a ghost value of no to make sure that something is submitted.

Then you can check if the value is yes and set the WHERE clause to where `xxx` != ''

Bob
flyboeing 30 Oct, 2015
Thanks for your reply.
I read it a couple times but I don't totally get it. If I am correct, when checking the checkbox it says to search for the fields that are not empty ('xxx'!= '').

This is how my checkbox lookes like:
Field name: fltr[movements_ewas][remarks]
Field ID: (empty)
Field Value: yes
Enable Ghost: yes
Ghost Value: No

This is how far I got. The last part I don't get. Where do you place the WHERE clause and in what kind of format? Do I place it in dhe setup tab or in my CC?
Sorry for all those questions😶
GreyHead 30 Oct, 2015
Hi Ruud,

Sorry, I misunderstood what you were trying to do :-( I had thought that you were searching in different columns.

The CC syntax will be something like return array( 'column_name != ' => '' ); but you need to wrap this in PHP so that it is only included if the checkbox returns yes.

Bob
This topic is locked and no more replies can be posted.