• Resolved ejaganece

    (@ejaganece)


    Hi,

    I’m using forminator form with Post data and custom fields for generating members, now i need to auto generate reference number for each form submit and need to set that reference number in advanced custom fields. Anyone suggest possible solution for this.

    Thanks,
    Jagan

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @ejaganece,

    Trust you are doing good and thank you for reaching out to us.

    For every form submission, there is a unique submission ID that can be added as a custom value for a hidden field. Please check this screenshot: https://ibb.co/mznT82r

    This hidden field can then be used to map to a custom post field on a post-data field. I hope the following documentation comes in handy: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#custom-fields

    I hope that helps. Please let us know if you need any further clarification.

    Kind Regards,
    Nebu John

    Thread Starter ejaganece

    (@ejaganece)

    Thanks for the reply, i tried those settings and received submission id via mail but not updated in custom field, in custom field showing “submission_id” in that field.

    Is it possible to add some custom name in front of that Submission ID.

    Thanks,
    Jagan

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @ejaganece

    Thank you for response and I’m sorry for causing a bit of confusion.

    The issue here is that the submission ID is not known until the submission is actually saved in DB and the post creation is slightly different – the post is created and the form submission is saved after that (so it could also include post data) which means that the “submission_id” is not yet substituted with actual number.

    This requires a bit of additional custom code. I came up with this code and it should work just fine:

    https://gist.github.com/adczk/f46b9545176bcb181830d8cc2329183c

    To add it to the site:

    – create an empty file with a .php extension (e.g. “forminator-submissionid-custom-field.php”)

    – copy and paste code into it

    – in this line set your form ID (should be the same number as in form’s shortcode)

    $forms = array( 2297 ); // comma separated IDs of forms this should work with

    – in this line set your “postdata” field id (if you only have one, most likely it doesn’t require change and is already correct)

    $postdata_field = 'postdata-1'; // field ID of post data field

    – and in this field replace MYCUSTOM with actual name of your custom field where you want submission ID to be stored

    $customfield_id = 'MYCUSTOM'; // set the name of your custom field to be updated

    – save the file
    – upload it (via FTP or similar way) to the “/wp-content/mu-plugins” folder of your site’s WordPress installation.

    It should then work out of the box.

    Note: it does not require hidden field to be set at all on the form and it doesn’t require it to be mapped to custom field in form settings.

    Best regards,
    Adam

    Thread Starter ejaganece

    (@ejaganece)

    Thanks for the update it’s working fine now, can you please tell how can change the submission id format like some name in front of id.

    Thanks,
    Jagan

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hey @ejaganece

    You cannot change submission ID as it is automatically generated by the database engine and only fetched by the plugin.

    But you can change how it’s stored in your custom field so you can e.g “prefix” that automatic number with some text.

    For example, if you want your custom field to store and contain it as (where 123 is just example – in reality is the actual submission ID)

    Membership ID: 123

    replace this line

    update_post_meta( $postid, $customfield_id, $entry_id );

    with these two

    $entry_id_value = "Membership ID: " . $entry_id;
    update_post_meta( $postid, $customfield_id, $entry_id_value );

    Now you can simply put any text to prefix the actual submission ID instead of example Membership ID above. I hope that makes some sense ??

    Best regards,
    Adam

    Thread Starter ejaganece

    (@ejaganece)

    Thanks a lot, it’s working fine.

    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @ejaganece,

    We are happy to hear that the issue has been resolved and marking this thread accordingly.
    Please let us know in case you need further help.

    Kind regards,
    Zafer

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Reference Number for each form submit with ACF’ is closed to new replies.