PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Dynamically Populating Price with gform_post_paging?

  1. theslink2000
    Member

    Hi,

    I've been trying to build an order form based around dynamic selection of a patients medications. I've got all the code working behind the scenes so far, however I can't seem to get it to populate the price field.

    I'm using a multi-page form where the first page is dynamically populated with a patients medications from the database as checkboxes likes this:

    http://pastie.org/5028907

    Then on the second page it checks to see how many checkboxes have been ticked and then multiplies that by a preset prescription charge. The only way I've found of doing this is using the gform_post_paging hook as the basic gform_field_value hook outputs $_POST data multiple times for some reason. When I dump the information (seen in the order_prescription_cost function) it prints all the correct information as floats, however the gform_post_paging hook won't update the price field. Here's the code:

    http://pastie.org/5028929

    I can't understand it, I've found a thread on here (http://www.gravityhelp.com/forums/topic/dynamic-population-parameter-outputs-outside-the-form-but-not-in-form-fields#post-64752) that states the gform_post_paging hook can be used like gform_pre_render, but it's not responding at all.

    Can someone please help!

    Posted 12 years ago on Wednesday October 10, 2012 | Permalink
  2. theslink2000
    Member

    For anyone finding this the answer was both weird to me and simple. You can achieve this using the gform_pre_render hook, which I would never have thought to use as the price is built on the second form page based on activity from the first form page. However, here's the working code:

    http://pastie.org/5341905

    Posted 12 years ago on Wednesday November 7, 2012 | Permalink
  3. Thank you for sharing your code.

    Posted 12 years ago on Monday November 12, 2012 | Permalink
  4. theslink2000
    Member

    No worries bud, you guys helped me sort it in a priority support ticket and I hate it when I find forum posts with no answers.

    Just hope it helps someone.

    Posted 12 years ago on Monday November 12, 2012 | Permalink

This topic has been resolved and has been closed to new replies.