Sugar Logic and Checkboxes

sugarcrmdevelopers —  December 16, 2011

Hopefully this saves some of you some time. Check-boxes don’t work quite as you (or more specifically, I) might have expected them to when they’re part of a formula or dependency using Sugar Logic.

Sugar considers these checkboxes to be boolean values in the database and in code, but in HTML they value of an input element of type “checkbox” gives a 0 or a 1. Very similar, but not exactly the same as saying true/false in from Sugar Logic’s perspective. So here’s the proper way to refer to something like this:

Forumla Editor Checkbox

In the above example, $mk_drink_c is my custom checkbox field.

The vardef file comes out looking like this:

$dictionary['Contact']['fields']['mk_drink_offend_c']['dependency']='equal($mk_drink_c,false)';