• Resolved d6p2b

    (@d6p2b)


    Quick question about the behavior of the pdb-before_submit_update (or _add) filter.

    I understand the documentation to say I should return the updated data. That appears to do what I want as far as saving the correct value to the database. However, it seems like I also need to set the updated value in the $_POST array for the user to see the change when the process_form() work completes and the new page is generated.

    Is that correct?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Roland Barker

    (@xnau)

    If you are doing something that you want to show up immediately in the refreshed page, yes.

    Depending on what it is you’re doing, it may be better to do this on the frontend with javascript. That is the preferred approach if you want the user to see the change. This helps avoid confusion if a form is submitted, but the returned data is changed with no explanation. How much of an issue this is really depends on what changes you’re making.

    The php filter is primarily for the purpose of making changes that the user does not need to see in the returned data.

    Thread Starter d6p2b

    (@d6p2b)

    I’m computing a derived result based on team membership. So, I need the server to do the heavy lifting. I was clobbering a value directly just to figure out how to get the information to flow in, compute, and flow back out.

    Thanks for confirming I need to inject my computed result into the $_POST so it will flow back to the user.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using pdb-before_submit_update to change data’ is closed to new replies.