Hello folks,
I have a question about multiple checkbox, I'm using them to fill a "IN" command in my search and I have an "All option" and I was thinking if is it possible when I check this "All option" the others will be unchecked like in this example below:
1:
2:
and if possible only using XML (without JavaScript).
Probably because you didn't say you wanted "*" and you are probably missing some backslashes - try this
<input type="checkbox" token="checkbox" id="checkABC">
<label></label>
<choice value="*">All</choice>
<choice value="AA">AA</choice>
<choice value="BB">BB</choice>
<choice value="CC">CC</choice>
<change>
<condition match="match($checkbox$,"\\*")">
<unset token="A"></unset>
<unset token="B"></unset>
<unset token="C"></unset>
<set token="form.checkbox">*</set>
</condition>
<condition>
<eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
<eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
<eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
</condition>
</change>
<default>AA,BB,CC</default>
<initialValue>AA,BB,CC</initialValue>
<delimiter>,</delimiter>
</input>
Try something like this
<input type="checkbox" token="checkbox" id="checkABC">
<label></label>
<choice value="All">All</choice>
<choice value="AA">AA</choice>
<choice value="BB">BB</choice>
<choice value="CC">CC</choice>
<change>
<condition match="match($checkbox$,"All")">
<unset token="A"></unset>
<unset token="B"></unset>
<unset token="C"></unset>
<set token="form.checkbox">All</set>
</condition>
<condition>
<eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
<eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
<eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
</condition>
</change>
<default>AA,BB,CC</default>
<initialValue>AA,BB,CC</initialValue>
<delimiter>,</delimiter>
</input>
Once All has been checked, you can't set anything else until All is unchecked. By setting the default to all options, when All is unchecked, all the options are checked. Obviously, you can use a different default if you prefer.
I tried this option, but when I try to put "*" as a value it doesn't work, do you know why?
Probably because you didn't say you wanted "*" and you are probably missing some backslashes - try this
<input type="checkbox" token="checkbox" id="checkABC">
<label></label>
<choice value="*">All</choice>
<choice value="AA">AA</choice>
<choice value="BB">BB</choice>
<choice value="CC">CC</choice>
<change>
<condition match="match($checkbox$,"\\*")">
<unset token="A"></unset>
<unset token="B"></unset>
<unset token="C"></unset>
<set token="form.checkbox">*</set>
</condition>
<condition>
<eval token="A">if(match($checkbox$,"AA"),"A",null())</eval>
<eval token="B">if(match($checkbox$,"BB"),"B",null())</eval>
<eval token="C">if(match($checkbox$,"CC"),"C",null())</eval>
</condition>
</change>
<default>AA,BB,CC</default>
<initialValue>AA,BB,CC</initialValue>
<delimiter>,</delimiter>
</input>
Hi @ViniciusMariano,
I don't think that's possible without JS, also because it isn't useful to have the All choice whwn you have the choice of all checkboxes.
Ciao.
Giuseppe
The "All" option would search beyond the available options, I have my groups(options) but I think would be helpful if the dashboard could search more options.