I’m wondering in forum but I dont see a right threat to solve my problems. I need to place a checkbox in a form and check if this checkbox is selected. Otherwise I cant save data in a database.
I already answered in the other thread but I’ll post it here for better overview
You can use it in the rules as required if they need to check it, another way is to use the parameter checked on your checkbox, this way it’s auto checked and users have to select or deselect it.
If you want to only save the data if the accept box is checked you should use the beforeSave method and check the input of the checkbox and act accordingly.
No, the post about roles was about a different subject.
You should add your checkbox in the required rules of your model. You should then create a beforeSave() function wich gets the data from the checkbox before it is saved in the database. Then based on the value of checkbox you should do what you want to do with the data.