logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$85
Gravity Forms Function/Hook to Calculate Endtime/Enddate

I am looking for a way to dynamically populate a gravity forms time field using a hook that adds a predetermined number of hours to a starttime selected by the user filling out the form.

For example, if a user selects a 4 (number field) and then selects a start time of 6:30 than the end time is dynamically populated to be 10:30.

What I am ultimately looking for is a function for the functions.php file that will accurately create an endtime and an associated parameter to be placed in the 'allow this field to be dynamically populated' of a time-box on gravity forms

Additionally, I would want a function for the end date that, if the event goes past midnight. Then the enddate = startdate +1. This would also ultimately be a parameter for a datebox on a gravity forms to accompany the end time function

So if a user selects a 4 hour trip to start at 10:00pm then the end time would be 2:00am and the end date would be the next day.


This is based on the dynamic population ability of gravity forms http://www.gravityhelp.com/documentation/page/Using_Dynamic_Population

and is being used to select the endtime for an event ( http://anthonydispezio.com/blog/gf-ecp-frontend-submission/ ) based on a set event duration.

This question has been answered.

ktrusak | 07/08/12 at 4:00pm Edit

Previous versions of this question: 07/08/12 at 4:32pm | 07/09/12 at 2:28pm | 07/09/12 at 2:28pm

The experts have suggested, on average, a prize of $90 for this question.

(5) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    07/08/12
    6:12pm

    This answer was downvoted by the top experts.

  • avatar
    Last edited:
    07/08/12
    10:48pm
    Arnav Joy says:

    can you show me the form where you have integrated this ?

    • 07/09/12 10:36am

      ktrusak says:

      I exported a basic version of the gravity form http://ge.tt/4RWWoEK/v/0

      Although the link posted above contains much more complete code for the time aspect the requested code pertains to

  • avatar
    Last edited:
    07/09/12
    1:25am
    Hai Bui says:

    So, in the form, the user would only fill start time and start date, they don't need to see or fill the end date and end time, is that correct? You only want to populate the end date and end time for Events Calendar Pro? If that is the case, I can help you do that.
    Let me know.

    • 07/09/12 10:37am

      ktrusak says:

      That's exactly what I am looking for. The user is selecting a 'service' that has an hour amount tied to it, and then picking when the service starts. The end time is only so it can be properly submitted to The Events Calendar Pro

    • 07/09/12 11:30am

      Hai Bui says:

  • avatar
    Last edited:
    07/09/12
    4:17am
    Rashad Aliyev says:

    I offer my solution for you!

  • avatar
    Last edited:
    07/09/12
    9:13am
    Daniel Yoen says:

    try this : http://anthonydispezio.com/blog/gf-ecp-frontend-submission/

    • 07/09/12 10:38am

      ktrusak says:

      This link is in the question description...

This question has expired.



Gabriel Reguly, ktrusak voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.