Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ayrton 3 posts 73 karma points
    Mar 09, 2021 @ 23:02
    Ayrton
    0

    Unique and successive identifier

    Can you add an identifier field that increases by one for each saved form?

    For example, starting with an identifier FV00001 and increasing by one, to be able to use that field in email subjects.

  • Nicholas Westby 2045 posts 7032 karma points c-trib
    Mar 10, 2021 @ 22:12
    Nicholas Westby
    0

    Hello Ayrton,

    I don't have time to answer this properly, so hopefully somebody else can chime in. However, the short answer is that that is indeed possible. Start here: https://www.formulate.rocks/articles/custom-field-types

  • Ayrton 3 posts 73 karma points
    Mar 11, 2021 @ 21:27
    Ayrton
    0

    Hello Nicholas,

    Thanks for answering, I understand that I should use the customizable fields, but would I have to save the incremental number in the database so they don't repeat when submitting forms at the same time? and then how could I use it in the subject of the email?

  • Nicholas Westby 2045 posts 7032 karma points c-trib
    Mar 12, 2021 @ 01:30
    Nicholas Westby
    0

    would I have to save the incremental number in the database so they don't repeat when submitting forms at the same time

    You'd have to persist this somewhere (so it can be remembered when the website restarts), assuming you want it to be truly incremental. If you just want it to be unique, you could use something like Guid.NewGuid() and that would be unique each time it's called. If you opt for the persistence approach, a database is a solid way to go (though not the only way).

    then how could I use it in the subject of the email

    This should answer that: https://our.umbraco.com/packages/backoffice-extensions/formulate/formulate-questions/88728-how-to-configure-a-contact-form-to-add-a-model-field-to-the-mail-subject

    TLDR: You create a custom field and set the value dynamically (or maybe use the existing Text Constant field type and set its value dynamically using a form submitting event handler), then you can extract the value of that field and add it to the subject line (the link above mentions two ways you can do that).

  • Nicholas Westby 2045 posts 7032 karma points c-trib
    Mar 12, 2021 @ 01:32
    Nicholas Westby
    0

    Side note: you technically wouldn't even need a custom field. You can technically change the subject line in the way you want entirely with the form submitting event.

  • Ayrton 3 posts 73 karma points
    Mar 12, 2021 @ 03:37
    Ayrton
    0

    Thanks for your prompt reply Nicholas

    What are the other ways?

    I need it to be a field because I also use it as an identifier (it must be incremental) when exporting in excel. I have implemented now it is through javascript saving the identifier in a txt file and incrementing it every time a form is submitted, the problem is getting that updated value every time the form is submitted, because the submit of the form I cannot edit it, there is any solution for this problem?

  • Nicholas Westby 2045 posts 7032 karma points c-trib
    Mar 12, 2021 @ 03:41
    Nicholas Westby
    0

    Sorry, I won't have time to elaborate for probably another week or so. Perhaps somebody else can assist.

    FYI, the above link technically has all the tools you should need to figure it out.

    One suggestion I do have is to not use JavaScript at all. If you do it the way I'm imagining, you don't even need to add the field to the layout for the form (can be a pure server side field, like Text Constant).

Please Sign in or register to post replies

Write your reply to:

Draft