Skip Navigation

[Resolved] Reset Post Form after Submission

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 1 year, 11 months ago.

Assisted by: Waqar.

Author
Posts
#2368243

Hi,

We have a post form we are using to submit data into our WP environment against a post type.

The process in summary is:
1) Click button which renders post form via a content modal.
2) In the configuration of the post form, we have the "Display a message instead of the form" option enabled. This removes the form from the content modal after submission.
3) After modal close, If we click the button again without reloading the page, the content modal re-appears but the form is removed as per #2.

I'm wanting to know if there is a way to reset/reinstate the form inside the modal without reloading the entire page after the modal has been closed or after the form has been submitted via javascript?

Cheers

#2369105

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

There is no built-in function available for this so it will require some workaround or custom code.

A simple workaround, in this case, would be to set the form to reload the same page after submission. A more complex option will involve writing a custom AJAX script that triggers when the modal is closed and re-loads the form, using the "cred_form" function.
( ref: https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_form )

Here are some useful guides on using AJAX in the WordPress environment:
https://codex.wordpress.org/AJAX_in_Plugins
hidden link

For more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.