Manaus Posted February 7, 2014 Posted February 7, 2014 Hello, I have a page with multiple checkboxes, each enables or disables (or should) a Page value in a template... the Page value represents $users linked to that specific page. I have this code: $d = $input->post->recipients; // array of values, such as rec[1010]=>true, rec[1024]=>true $c->of(false); // $c is the page foreach ($d as $dest) { $c->recipients->set($dest, true); // recipients is the Page field in the template } $c->save(); $c->of(true); Still I have it not working, Thanks for any suggestion..!
ryan Posted February 8, 2014 Posted February 8, 2014 I don't understand the code example well enough. But I'm thinking maybe you are intending to do something like this? $c->recipients = $input->post->recipients; While that would work, it would be better to do some thorough validation, like this: $c->recipients->removeAll(); foreach($input->post->recipients as $id) { $recipient = $pages->get((int) $id); if($recipient->id && $recipient->template->name == 'recipient') { $c->recipients->add($recipient); } }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now