The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Need help with Date Calculations

Labels

This Discussion is public

Notifications

I have a small website that I need help with.  The site is for a small charity with few members.  The members register and are required to enter a date that a test was done.  The membership rules say that the test must be repeated annually.  So I want to calculate the "expiration date" of their test...i.e. their test date + 365 days.  This is inside a repeating part of the form...

The calculation could be done via java and update the expire date real time, or via html and calculated after submission.  It makes no difference to me.

I've looked at the examples for doing this but can't get it to work inside a repeating area.

 

Help!?!

Hi Sarah --

I think what you want is this:

https://formidableforms.com/knowledgebase/frm_validate_field_entry/#kb-calculate-final-date

This will calculate it after submission (not in realtime). Is that the code you tried?

You would need 2 date fields in the repeating section, one that the user enters their test date, and an admin-only date field for the expiration date. Set the default value of the expiration-date field to '[date]' (without the quotes) so that there's a value in the field when the entry is saved, otherwise I don't think that PHP code will work.

HTH!

 

Thanks for the reply.  I did try this code.  It works if the original and calculated dates are not in a repeating section.  But inside a repeating section it does not work.

As soon as I posted that I was wondering if that's what you tried. For a repeating section, looks like you'll need to blow out the code using a foreach similar to what Jamie has done here:

https://formidableforms.com/help-desk/setting-values-in-repeating-section-via-frm_validate_field_entry/#comment-294569

 

Discussion closed.