Model Rule For Checkbox

Hi to all,

how can i check if user has selected checkbox, using model rules() function ?

Greeting and thanks

rules are for validation. What exactly do you want to accomplish?

i want check if the checkbox has been checked if not display a message that they have to do it.

example: by registration they have to accept the Term /AGB

use Compare validator (see docs)

example: check if it contains true (Untested but assumed that checked===true)


function rules()

{

    return 

    [ 

        ['yourcheckboxattribute',true,'compareValue'=>true], 

    ];

}



Thanks for your help