we have identified an issue/functional requirement that we have a droplist of countries and same goes for title like in below image
but we need that in response email body of send email save action it's Arabic text should be used instead of English value of selected option. Is there a solution or fix ? or we have to go for any customization ?
I don't think there is a way out-of-the-box to use the text instead of value. What you can do is create a custom "Send Email Message", similar to Sitecore.Form.Submit.SendMail and override the FormatMail method.
Create a list of countries items somewhere in the Sitecore Content Tree, and add a field for the text/description of the country. Then in WFFM droplist field, Set Items by: Selecting Sitecore Items and Select Root Item to the folder of the list of countries you created earlier.
You should see the countries in the preview section. Click the drop arrow for the Value and Text fields and then either select Display name or the custom field in your country item that holds the translated values.
The value submitted in form will now be the translated value correct for the language, using the lookup items list.
Related
I'm trying to make a poll results page with the results from a WFFM form. I initially took all the entered data(using AnalyticsFormsDataProvider), queried it, and then displayed the results. However, if no one votes for a particular answer, it wouldn't be in the entered data so it wouldn't show.
I want to display that the field had 0 votes, so now I'm trying to compare the possible answers to the queried list. However, I can't seem to find a way to access the values of the list items. Does anyone know the class those values are stored in and/or how to access them?
I'm using WFFM 8.1 rev. 151217 (Update-1) with MVC. It's a radio list field if that makes a difference from the other list fields.
Thanks,
You are able to get WFFM field as regular Sitecore item via standard API.
Available list items values are saved in "Parameters" and "Localized Parameters" fields. You can use Sitecore.Form.Core.Utility.ParametersUtil from Sitecore.Forms.Core to parse values saved in these fields.
This data is stored on your Radio List Field's Item in the fields Parameters and Localized Parameters.
If your code is within the Form's SaveAction or a Validator you will have access to the Field in the for AdaptedResultList args the SaveAction or via this.classAttributes["fieldid"] for the Validator. That will be enough for you to get the Radio List Item and then the Parameter fields.
If your code is not in a SaveAction / Validator I recommend passing the Form Item into your code possibly by Datasource and then retrieving the Radio List Item from that.
Finally the Items of the your Radio List field is stored in the format
<item><item>
If your radio items are actually items you will want to parse them using a regex
var regexItems = new Regex(#"<item>(.*?)</item>".ToLower());
var itemNodes = regexItems.Matches(FieldItem["Parameters"].ToLower());
Then you should be free to play with the list for your poll
I am using SharePoint access App and I have bind the left filter with Title field. By default, the list shows all the data including blank title. I want to filter the default list to show data only when title has value. I do not want to create custom action, because I want to hide this data from User.
Is there a way we can filter this data?
I found the answer:
I created a query to filter records where title is not null and updated the default view to pick records from the query.
I want create dropdown with static set of options. In fact it should select string value.
In Umbraco CMS is Dropdown List out of box, what is the same in Sitecore?
You can use Unbound Droplist under custom types field in sitecore. this is same as your Umbraco CMS, and assign static value by pipe separated for example country like India|USA|Canada
Below are the screenshot for more clarification
You can define your string values somewhere in the Sitecore tree as Sitecore items, e.g. put them in /sitecore/content/my-field-values as follow:
- sitecore
- content
- my-field-values
- string-value-1
- other string value
- and another one
and then use Droplist field type and set Source property to /sitecore/content/my-field-values.
Then value of this field will be name of the item, so one of your strings.
E.g. if you select string-value-1 item as the value of your field, both code samples will return string-value-1:
string value1 = item["Field using droplist field type"];
string value2 = item.Fields["Field using droplist field type"].Value;
Sounds like you need a DropLink field.
The selected value will be the guid of the Sitecore item. There is a straight equivalent - DropList this will store the item name rather than the guid.
The DropLink will be easier to work with as you can look up the selected value by id which will persist, rather than the name which could potentially change.
There's some info here on how the Droplink works with the API
Droplinks
There is a custom record type configured in NS. It has a name and a free-form text field called full_name. Name is a standard field, full_name is a custom field. There is another record type which has a field of type List/Record with the previous type. On the form this field is present as drop-down. The drop-down show names of records. The goal is to show full names instead of names in the drop-down. Is it possible to mark somehow full_name field so it is available in the drop-down view instead of just name? Any ideas how to achieve this with NS?
Depending on your exact needs, it may make sense to add another custom field to the record containing your drop down. You can source this field from the full_name field on the custom record. This field does not need to store the value if it's only for display purposes.
Add a new field to the record containing the drop down
Set the type to be text
Name it appropriately
Under the 'Sourcing and Filtering' tab, set the source by field to the drop down
A field with type List/Record type can only show standard Name field. However, you can create a custom field dynamically on before record load of a user event script. Check the nlobjForm.addField. Please keep in mind that the value of it will not be saved. Saving the value is another story.
I want add a custom field in a Sitecore template.
Field will be a drop down of hours (1 -23) and used to show open and close time.
Ex: 8am to 7pm.
How can I add a custom field for that?
You can use a droplist field and set it's datasource to a folder that contains numbered items 1-23.
You could also just use a plain text field and optionally add a validator, or a date-time field if you actually want the time (+date) formatted.