• Resolved qeyduey

    (@qeyduey)


    Hello,

    As the subject suggests, is this possible?

    It looks like the pods submission is being handled by ajax? Is this correct?

    If so, is it possible to disable refresh of the page after a pods form submission?

    Thanks in advance! =D

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter qeyduey

    (@qeyduey)

    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?

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter qeyduey

    (@qeyduey)

    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?

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter qeyduey

    (@qeyduey)

    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

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter qeyduey

    (@qeyduey)

    Thank you so much, Jory! =D

    That was a tremendous help! =D

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

    Thread Starter qeyduey

    (@qeyduey)

    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

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @qeyduey

    Ah thank you so much! Good luck with your project 🙂

    Cheers, Jory

    Thread Starter qeyduey

    (@qeyduey)

    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?

    Plugin Author Jory Hogeveen

    (@keraweb)

    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

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Submit Pods Form Without Refreshing the Page’ is closed to new replies.