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?
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
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).
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.
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?
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).
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.
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
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?
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).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).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.
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?
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
).is working on a reply...