Developer forum

Forum » CMS - Standard features » Datalists - sorted after checkbox input

Datalists - sorted after checkbox input

Lise Trabjerg Pedersen
Reply
I'm rather new in using the datalist-module, but I would like to show two different lists, based on the input from a form, which contains two different checkboxes (among other things) - and the two lists is generated, depending on the selected checkboxes.

But how do I express a SQL-sentence, in order to choose all items with this certain checkbox selected. I guess it's an easy one - if you know what to do - but I hope somebody kan give me a hint about it?

/Lise

Replies

 
Lars Britz
Reply

Depending on the check-box value that you have set, you can create a condition in your datalist. If you have set a default-value on the check-box of "1" or "True", which is the most normal setting, you will be able to filter out any rows that do not contain this value.

Example:
http://screencast.com/t/RYfSnQt9FwH

Probably not the best of examples, but in this view I am showing the users with AccessUserID = 1. In the same way, you can choose to view rows that contain "True" or "1". You can also view any rows that do not contain those values by simply changing the operator.


You can also create the view using Sql-statements, in which case you simply follow normal sql-syntax:
http://www.w3schools.com/sql/sql_where.asp
 
Lise Trabjerg Pedersen
Reply
Thank you for your answer, Lars.
In first place, I did almost as you suggests, but since it did'nt work, I thought there was another, more advanced solution for it. :-)
But although I have put 1 as validation value in my checkboxes, no value appears in the list, when I checks them and sends a form, and looks at the input after that.
Is it the wrong place, I'm defining the value - or perhaps an error in the module?? (I have tried in two different solutions - with the same result - no checkbox value)

See attached file, please.

/Lise
checkbox_value.jpg
 
Lars Britz
Reply
This post has been marked as an answer
It is the wrong place :)

A bit further up, there is an input-field named "Standard værdi". Try inputting the number 1 here instead.
Votes for this answer: 0

 

You must be logged in to post in the forum