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
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