I’m trying to populate a checkbox (Check the checkbox) based on a value from URL. I can do this with many regular like, text fields and stuff but I can’t seem to get the proper syntax for populating a checkbox.
How do I check a checkbox based on a variable from the URL of the field has “Populate value dynamically” is active for that field?
To confirm, the result you are striving for is to select any option in a checkbox field, correct?
Does the checkbox field have one or multiple options?
What data type is expected in the URL variable? A boolean? A string or numeric with a specific value?
I have a hidden checkbox field with a single checkbox.
The idea is to check that box, if the value for the checkbox is in the URL, ie https://www.mysite.com/myform?mycheckbox=checked
What I’m actually trying to accomplish is this. I’ve created a sort of psudo ticketing system. I’m using Gravity Perks to list the form entries in a table. I’m wanting to craft a URL from the table that when clicked, will open the form entry for editing, and allow me to set that checkbox as checked.
I’m not sure if it’s simply not something that Gravity Perks allows or not, but it appears not to work, at least from that interface. The checkbox is there, hidden within the form when rendered but I can’t alter the value.
Maybe there’s a better way to handle this, I’ve considered just writing a custom PHP script to handle this but it seemed like using a sledghhammer where a tackhammer would work.
Ok. To do this, you’d need the following:
- In the checkbox field settings, turn on the ‘Allow field to be populated dynamically’ option.
- Create your custom parameter.
- Set the parameter value to the checkbox option label in the URL. Let’s say your option’s label is “First Option”, then set the parameter in the URL to: example.com/?custom_param=First%20Option.
Save your changes.
That should dynamically select the specified option in the checkbox, whether the field is visible or hidden.
Yup that is what I am doing and it’s not working.
It must be a Gravity Wiz issue. This isn’t an issue when creating a new form entry, it’s an issue when using the edit form entry view within Gravity Wiz’s perk ‘GP Entry Blocks’. I’ll submit a ticket to them and see if it’s something that can be addressed on their end.
Ok. It would make sense that something is interfering with the custom parameter feature in your form.
I tested in a clean install and couldn’t reproduce what you described.
What happens if all other plugins are disabled except for Gravity Forms core? That would help you rule out the possible origin of the issue.
If you are up to try a conflict test, remember to do it on a staging or development environment.