PDA

View Full Version : bitfield default value?


Dr.CustUmz
02-12-2015, 10:23 AM
ok so i switched over to using bitfields and i have them working properly although i cant figure out how to have them all checked by default in the admin cp

i have my setting as follows:
<setting varname="drc_sg" displayorder="60">
<datatype>bitfield</datatype>
<optioncode>bitfield:drc_sg|blah</optioncode>
<defaultvalue>15</defaultvalue>
</setting>

i have set the default value to a few things but i cant figure out the math behind it, I have 6 options that i want by default all checked

NVM -_- should of figured it was binary

for users who came here looking for an answer - i have 6 options that i want all yes. 1 means yes(checked) so that would be 111111 (in order how you wrote your options) now convert that number from binary and that gives you 63 as a default value

so if you want every other one toggled itd be 101010 converted gives you a default value of 42

hope this helps someone