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.

Building a Time Card

  1. Hi All,
    I'm loving Gravity Forms, bought the develop license and now I'm rolling it out across all my sites, goodbye Contact Form 7.

    I'm in the process of building a time sheet form, you can see it at http://wdm.burlingtonbytes.com/#time-sheet/ . This time sheet will take a repair order, date, time-in (24hour), time-out (24 hour), and lunch and travel check boxes.

    When you hit submit, I need the form to take you to a confirmation page. This confirmation page will echo all the above values, and then display the total time on the job. I need it to calculate the difference between time out and time in, subtract 30 mins if lunch is checked, and subtract 30 minutes if travel is checked. I need this total time on the job to echo on the confirmation page. From there, user will be able to submit their time.

    Right now I'm using pages in the form, and GForm Post paging hook to give me an opportunity to process the total time. http://www.gravityhelp.com/documentation/page/Gform_post_paging

    On page 2 of the form, I am trying to use a html block to echo the variables and the total time variable.

    Does this seem like the best way to accomplish this task? How do I echo variables in the html block?

    Any help would be greatly appreciated. If it seems like a simple task for you, I'd be more than happy to pay to have this completed.

    Thanks

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  2. Is there a better place to post this?

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  3. David Peralty

    You've posted this in the correct place. I'm just trying to figure out the best way to do this, and if I can't figure it out, I'll pass it on to a developer.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  4. David Peralty

    Unfortunately, what you are asking for is beyond just a simple customization and as such, I can only point you in the right direction on a few things. If you want to hire someone to develop this, then you'll want to post in our Job Board - http://www.gravityhelp.com/forums/forum/job-board

    To start with Gravity Forms doesn't support reviewing submitted information before creating a post. So the easiest way to do what you ask is to create two forms. One to input information and using the redirect with Pass Field Data Via Query String to move the information submitted to the next form which will display it.

    On either the first form or the second form after it is submitted, or on the second form, before things are displayed, you'll need to do your time calculations. You'll have to write a PHP function in your functions.php file to grab the relevant details and do the calculations based on your criteria. Then pre-populate fields based on the result.

    Here's a forum thread on reviewing data before submission:
    http://www.gravityhelp.com/forums/topic/review-data-before-submiting

    Finally, your user can then click submit once again, and all of that data will be saved to the form. You could then export the entries on the second form and get everything you need to track time.

    Using the Gform_post_paging doesn't really allow you to easily grab field information from a previous field, and the HTML block doesn't automatically pull from previously entered fields either, which is why you don't see merge tags for fields listed in the drop down. You can do this through short codes as long as the data has been submitted from a previous form like I mentioned above.

    Check out this example:
    http://www.gravityhelp.com/forums/topic/inserting-passed-query-string-values-into-an-html-block

    Hope this all helps.

    Posted 12 years ago on Thursday April 26, 2012 | Permalink
  5. Check out this tutorial: http://gravitywiz.com/2012/04/30/simple-pre-submission-confirmation/

    Posted 12 years ago on Monday April 30, 2012 | Permalink