Hi @qeyduey
This is currently no feature of Pods that is available through the UI.
You can create a custom JS save handler that prevents reloading the page: pods_admin_submit_callback
. Such a customization would require knowledge of JS.
Code: https://github.com/pods-framework/pods/blob/main/ui/js/jquery.pods.js#L289
For non-coding options you should take a look at GravityForms in combination with our free addon: https://wordpress.org/plugins/pods-gravity-forms/
Cheers, Jory
Hey Jory,
Thanks for the prompt response! =D
After a quick inspection of this JS file, I can see that after the form has validated, you’re using document.location.href
to reload the page. Couldn’t I just simply block out that line of code to achieve the desired result?
Hi @qeyduey
Sure, you could do this but then you cannot update Pods again as that will overwrite your change.
It’s better to add the custom callback in one of your JS files.
This also gives you the opportunity to add some feedback to the user that his submission was successful or something.
Cheers, Jory
Hey Jory,
Thank you for the even FASTER response this time around! =D
I completely understand what you mean regarding the confirmation/feedback!
What do you mean when you say, “but then you cannot update Pods again as that will overwrite your change.” Can you clarify what you mean by this?
Hi @qeyduey
I meant that it’s not advised to change any core code from WordPress, plugins of themes.
If you chance code from any of these you cannot update that part anymore since an update will overwrite your changes again.
That is why WordPress and it’s plugins use hooks to allow overwrites/changes to the system.
In this case Pods allows creating a custom callback so you can overwrite it’s default behavior.
Cheers, Jory
Ahhhhhh! I see your point! Thank you for this insight, Jory!
Can you give me a little help in the right direction with a tiny snippet of code that I could use to achieve the callback? Please, please, pretty please with cherries on top! =D
Thanks in advance, Jory! =D
Hi @qeyduey
It’s just a Javascript function you can add in your theme or a custom plugin:
function pods_admin_submit_callback( d, $submittable, id ) {
// Do something here.
}
Cheers, Jory
Thank you so much, Jory! =D
That was a tremendous help! =D
You’re welcome! The best way to say thanks is to leave a 5 star review at https://wordpress.org/plugins/pods/ and (if you’re feeling especially generous) become a Friend of Pods at https://friends.pods.io/
Cheers, Jory
Hey Jory,
Already left a 5-star review a while back! However, I just made an anonymous donation now via your link! Thanks again for the awesome support! =D
Hi @qeyduey
Ah thank you so much! Good luck with your project 🙂
Cheers, Jory
Hey Jory,
So I attempted to place that code in a separately loaded JS file as follows:
function pods_admin_submit_callback( d, $submittable, id ) {
console.log('test');
}
It doesn’t log ‘test’ to the console and instead just reloads the page as normal.
Have I done something wrong?
Hi @qeyduey
Please make sure this javascript it loaded at all by adding the console log outsite of the function.
Keep in mind that there is also a second callback for errors: pods_admin_submit_error_callback
Cheers, Jory