Jump to content

Recommended Posts

Posted

Hi all fairly new to php and processwire and am having trouble setting a value of one of my fields.  Quick background - I have active projects, pending projects, and completed projects in my system.  If the job is active, then I need to set the field 'is_active' to checked (or I can have a selection and set the selection to Active).  Either way I have an if statement determining if the project is active.  Once I determine it is active, how do I set a checkbox to checked and store in on the databse from the php side?

Posted

ProcessWire handles checkboxes internaly with 0 and 1 integers. So you need to do this, to enable the checkbox field and save it. 

$page->of(false); // disable output formatting

$page->checkbox = 1;
$page->save(); 
  • Like 2

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...