• Resolved matussvincak

    (@matussvincak)


    Hello everyone,

    I want to save some Unique identifier for every submission, which can be created for example like ‘YEAR’.’KEY’. It should be sent in e-mail notifications and also saved in submission.

    First attempt is to do it like hidden field with value ‘2020{submission:count}’ problem is, that it is filled with value during form creation this way. That means if 3 users open the form in the same time (between form creation and submitting it) it will save 3 same values and it is not unique. (it also saves like 20206 not like 20200006 what is not such big problem ) So it is not updated on store submission action.

    My second attempt is to use Calculations from DEV mode {calc: identifier} like 20200001 + {submission:count} (Last 1 is due to 0 starting count index) and store it in hidden field (I have tried visible HTML field also), but when the form is created value of {submission:count} is probably not set and stores value like 20200000.

    Third attempt was to use Calculations from DEV mode {calc: identifier}, which works perfectly. Even when more active forms are saved in one time, but the {calc:} values are not exported in .csv export.

    I want to create some automatism behind it, so if I can just access {calc:} values during NF_form_processing hooks. But I am not sure if I can find it in
    $form_data during form processing

    maybe in

    $settings = Ninja_Forms()->form(e.g.2)->get_settings();
    $calculations = $settings[‘data’][‘calc’]

    or

    $sub = Ninja_Forms()->form()->get_sub( 1 );
    $more_data = $sub->get_extra_value( ‘more_data’ ); // or ‘calculations’ ?

    I know this is probably merged from two questions – first is how to store it in some field and if it is not possible, how to retrieve it from submissions.

    Sincerely Matus

    The page I need help with: [log in to see the link]

  • The topic ‘Every submission unique key with calculations’ is closed to new replies.