How to save Checkbox value in Form Settings Page [RESOLVED]

Hello there!

I’ve added a settings page for all forms (not the general settings) according to this page and want to save a simple checkbox value in there and read this value in the gform_after_submission function.

I checked out some other plugins, however they do very complicated things and i wondered how I can easily achive that since I have not much experience about gforms.

Greetings & thanks in advance

Hi Jose !

Just for some additional context, can you tell me what actions you are looking to perform after the submission event ? ( that is, is the value needed for rendering in a new page )

Are you planning to program some custom PHP code for other uses, or looking to avoid coding if possible ?

Hello @JASCoder!

No, the value is not needed in a new page, just in the gform_after_submission action to decide how the form gets treated.

I’m not planning to do more code, it should be as easy as possible with the least possible code.

Hey again, Jose

In your registered gform_after_submission callback function you’ll get access to the entry values (and related form object) as they are the two provided args passed to your function.

If you dump all the contents of both into debug you can view all that and see where the item is stored in the entries arrays. (I’ve spent many hours of study of that, and it’s all quite deterministic)

But hard-coding your reference to the needed value could be difficult to maintain thru future changes to your form. I have tackled this issue directly myself, in developing a plugin that saves all flagged field data into either the user’s meta data table or their live _SESSION array - so you can reference them all by name directly, which can be much more maintainable. If this route is more attractive to you, just message me directly for more info, as I am still seeking some beta testers :slight_smile:

Cheers and good luck friend,

1 Like

Hello James,

Thank you, but actually i really need just one checkbox and for this purpose, referencing this by id would be okay… All i need is an example code how i can add a checkbox to the form settings, save it within the form settings and read it in the gform_after_submission callback function as easy as possible…

I wouldn’t want for this very basic feature to use a plugin… :slight_smile:


Hi again Jose !

When I added admin form settings support in my new plug-in, I studied the code for this plug-in:

That should have all the working example code for what you are asking about.

Good luck friend !

Thanks, James!
This actually helped me - Instead of adding a whole new page, i just added an input to the Form Options.

1 Like