Skip to main content

Hello,


simple question: How can I validate a checkboxlist control, i.e. that the user has selected at least one value in the list?


Thanks,


Anders

On the Form, when you select the rule: if the Form passes validation (configure), there is a check box for "required".  When you check the box for your control...it should require at least one box to be checked.  Is that not the case?


11274i3B1570816AC7C0B8.png

Hi again,


 


thanks for your reply - this is exactly how I thought it should work, but the problem is that it doesn't. This validation rule does not seem to kick in, I suspect the reason is that the control is not empty even though no values has been selected (due to the underlying xml). 


 


A more general question is how to in a rule determine both whether any checkboxes have been selected, and also which values have been selected. So far I have not been able to do neither...


 


Anders


Good day Anders,

I'm havong the same issue and i'm using Smartform 1.0.5.

Have you resolved this?

 

Bibi

 


Hello'


 


 


This is a known issue on smartforms 1.0.4 and has been fixed on 1.0.5,I don't understand how you are still getting the same error. I will look into it and see if there is something that can be done to fix the issue.


 


Kind regards


Nelly


HI All,

 

Does anyone find a solution?

 

Regards,

 

Bibi


Hi Vestbo and BBk



I suggest that you create your own validation by using the advanced condition rule.


It will be a little bit more complex that just using the validation rule, but this could work with the right conditions set in the advanced rules which will make it act exactly like the validation rule.


Can you elaborate on what would need to be set in the advance condition to make this work?  I've tried is empty and that doesn't fire.  What should it look at to know if nothings been checked or not?


One way to use an advanced condition would be to test the values in the box and if one or more is met (depends on if you want one or many checked), then fire your stored procedure.  If the conditions are not met then show a message to user.

 

You would have to put in a condition for every value you have in your checkboxes.  In the below example I have a check box with values one, two and three.

 

 

12834i37F02F7B0DE924B7.png


Hi All


 


Daerne I have reproduced your suggestion but was unable to get the the required outcome. I however did find the perfect solution to check if none of the options in a checkboxlist has been selected and it can also be used to check if a single or more options has been selected (validate).... as i previously mentioned, using a advanced condition you can create your own validation via the rule set constructed.


 


I created a Item view with a checkboxlist containing 3 static values (A,B,C) and a button with the following rule construction:


When MyButton is Clicked


   if an advanced condition is true   - Condition ( CheckboxList (=)Equals <collection><object><fields/></object></collection> )


      then show a message to the user (configure)   - Validation Did Not Pass


   else


      then show a message to the user (configure)   - Validation Did Passed


 


When the button is clicked and the view executes the rules, they check if the checkboxlist is empty, if they are a message is displayed requesting user to choose a option, if the checkboxlist is not empty a message is displayed stating that validation passed.


 


If you need to know how to to get the ability to "to check if a single or more options has been selected (validate)" please let me know and i will send my small packaged project that would basically supply you with the functionality needed.


 


Kind Regards


Raymond


Reply