We used the built in choice field control and modified it to allow you to specify the text and value fields. The built-in choice field only allows you to specify one value to be used for both the value and text properties. Currently we have only built it out for a Drop Down control. It can be extended to include other choice fields. We also modified the Forms Module Notification control that George Saadeh created. We added an additional property where you can specify the name of the control that you wish to use for the email to be sent to.
- Add Drop Down control to the Forms Toolbox collection -
To add it to your site, just follow the Sitefinity documentation for adding new Toolbox controls for Forms. The settings to use are show in the screenshots below.
- Update the Form Control -
Go to the settings for the form control under the Pages toolbox collection. Update the settings as shown in the screenshot.
- Create a new form and add the Drop Down control to the form. Add in the choice fields as you wish. For the choice fields, there are two text boxes. The first is for the text property and the second is for the value property. Here you can specify the email address(es), separated by a pipe "|", to be used for the recipients of the form submission. In the "Advanced" section at the bottom, make note of the developer name or change it to something you can remember. This will be used on the form to tell it to use this control for the recipient field of the email. (See screenshot)
- Go to a current or new page and add the Form control from the toolbox. In the designer settings, select the form you just added the drop down control to. Then at the bottom, you will see a text box labeled Drop Down List. Here you will specify the control name that was already set or that you changed in step 3. (See screenshot)
Once you have the form set on the page, the Form control will loop through the fields of the form and check to see if any of the fields names match the value you specified in step 4. If found, it will use the data from the value property of the control as the recipient of the form. This will override any value you have specified in the second text box in the form's designer.
This control should be able to work with 4.x and 5.x sites. You just have to add the reference to your version of the Sitefinity dlls in the project and then build the project. From there, just copy the dll to your Sitefinity project's bin folder and follow the steps above to get it inside your site.