Support

Account

Home Forums Add-ons Repeater Field Add Repeater entries from front end with GF

Solved

Add Repeater entries from front end with GF

  • Hi Elliot, guys…

    I’m creating a job board like theme for a personal project.

    On the backend I have a repeater field for that custom post type, as it’s structure I have: applicant ID and cover letter.

    I created a form with gravity forms with Update Posts plugin and Custom Fields plugin. I store the user ID on a hidden field and provide a text area for cover letter.

    The logged in applicant will fill the cover letter and submit, I will take it’s ID stored on the repeater entry to populate applicant data (name, url, avatar, etc) on the employer’s control panel

    The issue I’m having is that the variables are being set correctly to the repeater but they are updating the same initial value instead of adding new entries to it.

    Can anybody help me providing a link to a similar question, tutorial or whatever other thing you consider proper. I have spent hours and hours without luck.

    Thanks!

  • Hi @Jaypee

    There is no current ‘easy’ connection from GF to ACF and the repeater field.
    I’m guessing that you have selected a custom field such as ‘applicant_0_cover_leter’ for the custom field where the GF textarea to save to.

    Instead of the ‘0’, you want this to be an incremental number, and this is where it gets tricky.

    You will need to find a GF filter that allows you to hook in and modify the custom field name for the GF field to save to.

    If you can do this, then you can find out how many rows already exist (or perhaps match the current user’s row) and find out the new row number to replace ‘0’.

    I hope that helps.

    Thanks
    E

  • Hi Elliot,

    Thanks a lot for always being there for answer all my questions.

    Basically what I have to do is to populate a repeater field from the front end so it might be a better option to forget GF and just go directly to your front end form?

    Regarding this matter, I have a couple of questions:

    • Within repeater field I have 2 subfields: USER ID which I want to populate automatically and cover letter.
    • I want to only show on frontend the cover_letter subfield all other custom fields I’d like to hide.
    • The form then will be basically one textarea for the cover letter and the subfield for user ID would be hidden and autopopulated.
    • Finally have the “Apply for this job” button and that’s all.

    Sorry for bothering you this bad but I have never worked with front end form before.

    I’m attaching an image to show you what I see on the page when adding the form (in addition to that I also see all other custom fields).

    If you could guide me or point me to any resource to help me understand and solve this, I will be eternally appreciated.

    Best!

  • Hi @Jaypee

    If all that is needed is a textarea, it will be much easier to code this yourself.

    1. Create a custom page template for the page
    2. Code a <form> that contains a textarea field
    3. Add some PHP to the top of the template which can detect if the post has been submit
    4. If a submission is detected, run some custom logic.
    5. This logic can use the get_field function to get the repeater field, and then append a new row using the posted textarea value, and the current logged in user ID (from a WP function), now just use update_field to save the repeater value.

    Please read the docs for both update_field and repeater.

    Thanks
    E

  • Hi Elliot,

    Thanks a lot for following this issue I was having, and many other you helped me to address 🙂

    I ended solving this with a gravity forms hook (to stick to gf). The hook is very simple and I’m posting just in case someone else might find it helpful.

    add_action("gform_after_submission_5", "acf_post_submission", 10, 2);
    function acf_post_submission ($entry, $form)
    {
       $field_key = 'field_52fae7b9b229c';
       $post_id = $entry["post_id"];
       $value = get_field($field_key, $post_id);
       $value[] = array('app_id' => $entry[3],'app_cover' => $entry[2]);
       update_field($field_key, $value, $post_id);
    }

    The only issue I’m trying to solve now is to write a script to don’t let the same user ID submit this form if it already submitted. I’m using the same form (ID->5) for all job posts, so I have to set no duplication for that post id only and allow if it’s a different id, but that’s more a question for gravity forms guys.

    Anyways if you have any idea, I will appreciate that you share it with me.

    Thanks for all.

  • This reply has been marked as private.
  • I have a UPME plugin that shows user profile in back end and front end also how i integrate ACF plugin with UPME plugin ??? i want to use repeter feilds at user profile which is coming from UPME plugin

  • @anamika Did you ever find a solution?

    I want to use repeater fields on user profile front end pages as well.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Add Repeater entries from front end with GF’ is closed to new replies.