I just discovered the value_FIELDNAME='default value' for Form Builder. This seems to work for text entry, textarea, and radio button, but I can't seem to get it to work for checkbox... I tried '1', 'checked' and 'true' for the default value, but it's not working.
I know that I can set it inside the form, but I want it to be dynamic, based on the current smarty variables.
Any ideas?
[SOLVED] Form Builder default value for checkbox?
[SOLVED] Form Builder default value for checkbox?
Last edited by Wishbone on Thu Apr 25, 2013 2:46 pm, edited 1 time in total.
Re: Form Builder default value for checkbox?
It's just a suggestion as I didn't have time test it: why not true or 1 (without the quotes or double quotes)?
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Form Builder default value for checkbox?
Yep.. I tried y, yes, checked, true, 1
Re: Form Builder default value for checkbox?
I was able to do it with a jQuery hack, but it's a bit hokey.
Re: Form Builder default value for checkbox?
Yep I was pretty sure you had tried...Wishbone wrote:Yep.. I tried y, yes, checked, true, 1
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Form Builder default value for checkbox?
I can usually look at the code and solve most issues whether it be module or core, but I couldn't figure out this one.
I'll look at it again. If it just wasn't implemented for checkbox, I'll see how it's done with RadioButton, make a fix, then submit the code in a feature request.
I'll look at it again. If it just wasn't implemented for checkbox, I'll see how it's done with RadioButton, make a fix, then submit the code in a feature request.
Re: Form Builder default value for checkbox?
Would you mind trying 't' as value:
It's a wild guess after looking at the code.
Edit: checked it on a site en seems to work.
Code: Select all
value_FIELDNAME='t'Edit: checked it on a site en seems to work.
Re: Form Builder default value for checkbox?
Yes! It does work. I saw the 't' in the code, but foolishly ignored it because it always says 'value="t"' in the resulting checkbox, regardless of the "Value when checked/unchecked" in the form. Makes sense now 
Thanks!
Thanks!
Re: [SOLVED] Form Builder default value for checkbox?
It definitely should be documenten.


