Sitecore WebForms for Marketers : send email to users - sitecore

I am using Send Email Message action. I have added one action for send email to admin and another thank you mail to user who filled the form so my question is how I can add user email in Send Email Editor. I tried to add email Insert Field but it is not working.

EDIT:
By Default, the TO Dropdown only allows content from the Email Field Type. To allow other field types, please go to to the Send Email Message action found here by default: /sitecore/system/Modules/Web Forms for Marketers/Settings/Actions/Save Actions/Send Email Message
go to the Editor section, and enter the following into the QueryString field:
AllowedToTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}
The first guid is for the standard Email Field type, and the second one will be your custom field. This should allow you to choose from those fields in the TO field.
For best practices, you should duplicate the Send Email Message action, and apply the changes there to prevent issues with future upgrades.
To allow your custom fields to be selectable for the CC and From fields as well, your query string would look like this:
AllowedToTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}&AllowedCCTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}&AllowedFromTypes={84ABDA34-F9B1-4D3A-A69B-E28F39697069}|{YOUR CUSTOM FIELD TYPE GUID}
From there, to send an email to one of the fields on the form, simply choose the field by clicking the little arrow next to the 'To' field
I have noticed a bug in previous version of wffm where it places double brackets around the field name, for example: [[email address]]. If you notice the double brackets [[..]], then erase the entire field and select it again as shown above.

I found there is an issue a with the To: field in certain browsers - not sure if this is related to Bug 402562.
In Chrome I get js error messages but in Firefox I can insert the email field with no issues.

As stated my #amir818, you need to add the field name with brackets in the To field. If you are using Chrome then the arrow may not work due to a javascript error, it works in IE though.
Alternate way to add the field into the message body from the Insert Field droplist and then copy+paste into the TO field. Looking at your field names it should be [Emailaddress].
The double brackets that amir mentioned is a bug, you can get a fix from Sitecore and quote ticket number 402562. When you edit the form again, the field has 2 sets of brackets added which then breaks the send action, e.g. it would end up as [[Emailaddress]] which is incorrect and therefore fails

Related

Save the dynamically populated value on dropdown

I'm using wagtail CMS for Django, I want to add a dynamically populated value for a dropdown and save it on the Page model, this is my code:
class MyPage(Page):
domain = CharField(max_length=10, choices=MY_CHOICES)
subdomain = CharField(max_length=10, choices=[('', '------')]
I've got some frontend logic to populate dynamically the options for subdomain, but after I hit save I got: The page could not be created due to validation errors And in the subdomain field: Select a valid choice. [my value] is not one of the available choices.
I can't use ForeignKey to populate subdomain because it depends from an external API service that we're using.
I tried to use a custom field that inherits from CharField with no success, it looks it executes validate method only for the domain field.
If you use the choices argument, you have to predefine the list of possible values. Read the relevant part of the docs (last two paragraphs of that section).
You could omit the choices argument from the model field definition and only render a HTML select tag in the frontend (which is then filled with options dynamically, like you explained).
You could also look into changing the default widget of the CharField to a select tag, like this answer and this part of the docs show.

How to remove required validation from WFFM hidden required fields in sitecore?

I am working on WFFM Sitecore.
I have one droplist "Title" with option of
Mr
Miss
other title
And one required text-box called Other.
The text-box is hidden on page load and it will be shown only when the user selects the other title option from droplist.
If we are selecting Mr or Miss then the Other text-box is hidden but it is still a Required field. When we submit the form it triggers the required field validation of the hidden Other text box .
How can I remove the required fields that are hidden on WFFM save action.
You will need to remove the "Required" flag from the field in the WFFM editor, and then add some custom JS validation that checks the Title field and if its set to Other Title, validate that the text box has been populated.
You can't do that in WFFM without custom JavaScript.
You would also want to make sure that your server code validates this again to protect against someone trying to bypass the JS validation.

How do I get the value of a WFFM field as a tag and output it in a Sitecore DMS report?

If I create a Web Forms For Marketers form with Analytics enabled I can choose to add each field as a tag to a Visitor. I can't see how to configure which tag they should be added to, or even what the tag is called by default (I'm assuming a tag with the field name is created).
I'd also like to know how to retrieve the tag data in a visit report (i.e. the one you'd get if you double clicked on a form submission in the Form Reports dialogue). I can see how to access plenty of inbuilt tags, but I can't find out how to fill these specifically from the form, and I cant see any fields in the report designer representing the field names I have.
Question 1: How to set the name of the tag
If you set the "Tag" checkbox on the form field, the Item Name (=field name) of the form field is used as tag name.
If you have database access, you can check the "VisitorTags" table on the analytics database to see which tags are written and how they are called.
Question 2: Retrieve Tag data in visit reports
In the VisitDetail report, the following inbuilt tags will be displayed if set:
Email
First Name
Second Name
Company
Organization
Full Name
StateProvince
Name your form fields accordingly and the values will be used in the report out of the box.
If you want to use custom tags in reports, have a look at the .mrt files in /sitecore/shell/Applications/Reports/. You will have to extend the report to use your own tags.
Example: Adding a custom tag to the VisitDetail report.
Extend the SQL Query to fetch tags in the /sitecore/system/Settings/Analytics/Reports SQL Queries/Visits Visitor Tags item. Add the line
, MAX(CASE WHEN [TagName] = 'SomeCustomTag' THEN [TagValue] ELSE NULL END) [SomeCustomTag]
Extend the VisitDetail.mrt, add a column with value SomeCustomTag to the VisitorTags section just like the predefined tags.
Use the value of your custom tag inside the report text by using {Visit.VisitorTagsRelation.SomeCustomTag}
I use a text editor to edit the .mrt files, but you can probably also do it in Reports Designer.

Using jquery autocomplete Django form

I am using jquery autocomplete with my generic views on Django. I am getting the list via AJAX, but there is one problem. When the user get the category he wants, he will select that value. Thus, if I append the value on that field $("#id_category").val(ui.item.value); it will show the pk on that field instead of value, so if I append $("#id_category").val(ui.item.label); django will complain it should be the instance. Django is completely right. How to make this work?
Edit:
I have made id_category hidden field and added category_display to append the text value. It is working. But while editing the category_display would be empty. Again I am using generic view. How to solve this one on the edit?
I had similar issue and I suggest you to think about question: 'What will happen if user enters not valid category name(category with this name doesn`t exist)?'
if you need to accept entered value and add new category, you have to make clean_category method in form:
def clean_category(self):
name = self.data['category']
return Category.objects.get_or_create(name=name)[0]
and display ui.item.label for user
if new category isn`t acceptable you can raise error in clean_category method or use something like select2(http://ivaynberg.github.io/select2/) for your field. I choose second variant.

Remove "Name" field from Joomla registration form

I would like to remove the Name field in the Joomla registration form.
I have tried editing the /com_users/models/forms/registration.xml
I've tried removing the field from the XML file and I've also tried to set it as 'optional'. Neither of these work. The is a registration failed message in the next page in either case.
Found the instructions http://www.2createthatwebsite.com/tutorials/joomla-tutorials/remove-fields-joomla-registration-form
You need to edit the libraries/joomla/database/table/user.php file.
You need to edit the check() function.
In my case, I added a:
$this->name=$this->username;
at the beginning of the check function, that sets the username as the name, juse before saving.