Kentico 9 form macros and different notification recipient based on dropdown value

为君一笑 提交于 2019-12-25 18:33:21

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!