Support » Plugin: Advanced Forms » Checkbox record date / time ACF + Advanced Forms

  • Resolved Columbus

    (@christof15)


    Hi, thanks for this great plugin! I’ve created two forms with ACF Pro in combination with Advanced Forms (Share this article and Feedback). Now I would like to record the date and time after ticking a checkbox for the GDPR Privacy Compliance. Important is that this date + time is being send in the confirmation e-mail.
    I know this thread but since I use Advanced Forms i’m not sure what way to go. Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • paralleljames

    (@paralleljames)

    Hi Columbus,

    I would advise having a hidden field that is populated with the date/time when the checkbox is ticked using JS.

    This can then be included in the email in the editor, will be saved in the database if you have turned on entries as well.

    
    document.getElementById('acf-checkbox-id').onclick = function() {
      var date = new Date();
      document.getElementById('acf-field-gdpr-date-field').value = date.toString();
    }
    
    Columbus

    (@christof15)

    Hi ParallelJames, Thanks for your reply. So I need to put that code within <script> tags in the <header>? I replace the field values with the field_5cdfbd3b77f32 key? Then I create a (admin hidden) date/time field? Should it be conditional? Thanks!

    • This reply was modified 8 months ago by Columbus.
    Plugin Author fabianlindfors

    (@fabianlindfors)

    Thanks James for helping out, your suggestion seems like a nice solution.

    I would add a regular ACF field for this datetime and then hide it from the front-end using CSS. The snippet James sent should be added to your script file (or tag) and run when the document is ready. You might have to adjust the selectors acf-checkbox-id and acf-field-gdpr-date-field to match your fields. Check your form markup to find the proper ones 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Checkbox record date / time ACF + Advanced Forms’ is closed to new replies.