Skip Navigation

[Resolved] How to hide a custom field group but still submit the data?

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 18 replies, has 2 voices.

Last updated by Minesh 1 year, 7 months ago.

Assisted by: Minesh.

Author
Posts
#2591071

We need to catch them at the time of form submission. This frustrating thing is, this used to work just fine it is only a problem recently. We used to be able to retrieve those values from the form submission data even if they were not being displayed. You say it is working as expected, but it is not working like it previously did.

I’m having a hard time understanding what you are saying about the data and fields, but it may be because we simply need it when the form is posted, not to retrieve it at some later time.

I guess if we can not rely on the field being there I will just remove the conditional group entirely and inject them with JavaScript. This all feels like a massive house of cards ready to tumble down with so many patches required to do what is needed but at this point we have no options.

#2591095

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

We need to catch them at the time of form submission. This frustrating thing is, this used to work just fine it is only a problem recently. We used to be able to retrieve those values from the form submission data even if they were not being displayed. You say it is working as expected, but it is not working like it previously did.
==>
I'm not sure why it used to work or as you said it should be working before but not now. The thing is that we have to use the latest version and act accordingly.

Have you checked what I said?
What I was saying is when I saved the form when no fields are added to the form still in the backend the same fields has the values intact.

But still you need to catch the field values when you submit the form as shared you will have to use the hooks "cred_before_save_data" or "cred_save_data" and get those field values using the get_post_meta() function.

#2591355

This is going nowhere. It was working before, so instead of simply saying "we have to use the latest version and act accordingly" it could be also said "something may have become dysfunctional and should be fixed". Who can say which it is.

We will just use our javascript form field insertion since that works reliably and probably won't be broken by your future code changes. HOPEFULLY.

I don't understand why you keep bringing up HOOKS, because we need to catch upon SUBMISSION. A hook would fire whenever.

#2591673

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I'm not sure if you know when the hook is fired.

The "cred_before_save_data" hook will fire just before it will save the data:
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_before_save_data

This hook allows doing a custom action right before saving or processing any data but after validation.

And "cred_save_data" hook will fire after the post is saved:
- https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

This hook allows doing a custom action when post data is saved to database.

If your requirement is to catch the content when you click on submit button then you will have to go with the custom JS solution you are using.

Again, another solution as I shared before is to pre-populate the field values by adding the generic fields.