问题
I have a form field as a drop down (ReasonForMessage) with the data like this:
email1@test.com;Reason One
email2@test.com;Reason Two
So user can select a reason, and then the notification would be send to address attached to that reason. If the Email Notification, for the recipient emails, how do i grab just them email portion with a macro.
Is this correct? {% ReasonForMessage %}
And how do i get the second part of the data, the actual Reason?
I'm basing this on this article (https://devnet.kentico.com/articles/how-to-send-form-notifications-to-different-emails-based-on-field-values) just not sure it's still valid with Kentico 9.
回答1:
Try this.
You can try using a delimiter to store both the email and display text, like the colon below...
info@company.com:General;General
sales@company.com:Sales;Sales
support@company.com:Support;Support
Then, to get the individual stored values use Split() to get the email and display text respectively...
{% category.Split(":")[0] %}
{% category.Split(":")[1] %}
来源:https://stackoverflow.com/questions/38373958/kentico-9-form-macros-and-different-notification-recipient-based-on-dropdown-val