Home Forums General Issues Passing all ACF form data to a React table Reply To: Passing all ACF form data to a React table

  • @hube2 Thanks for the help! Here’s what I found/did. I’ll double check your code, (because I like it better than mine). In general I’d say it would work. However (not to be argumentative because I really appreciate the help) get_field('time_picker_name', $post_id) will always return true.

    This is because date picker automatically selects the current day (whatever ‘today’ is) even if no other value has been selected. So for instance on an apparently blank field it’ll return today’s date. When a date is selected afterwards, it changes to that date and explicitly populates the field.

    As I said I prefer your code though because it doesn’t rely on checking against a different field like mine does. I needed to do this…

    $request_status = get_field('request_status', $post_id);
    if ($request_status !== 'Complete') {
      $formatted_date = '';
    } else {
      $date_complete = get_field('date_complete', $post_id);
      $date_completed = new DateTime($raw_date);
      $formatted_date = $date_completed->format('M j Y');

    But, I don’t like that I have to rely on my user explicitly setting ‘Complete’ as an option for the select field. I’ll continue to research/work on this.