Form Fields‎ > ‎

Multiple choice

With this option you can create different choice fields like check boxes, radio boxes, drop down lists etc.






Multiple Choice (with Drop Down) The Multiple Choice with Drop Down option is used to create a list of items for a user to choose from. The Drop Down field allows the users to select an option from a given list.

Let's create an example where you create a drop down list called Products, in this list you have to add some Items, use the Items box and list several items, each item to be added per line (e.g. car, laptop etc). If you want, let's say, to add different colors/sizes for each item, you can create another drop down list which has to be linked to the Products drop down and when the user selects a product from the list, the second drop down calls only the colors available for that specific product only.

Here's how you can do it: in the second drop down list set on "Link to" option the "Products" field, then, in "Items" box there's a certain syntax which has to be correctly used to make the form work. You have to prefix the item with the name of the parent (in our case: "car") and separate the parent from the child using slash ("/"), for example if you want to display red, yellow and black for the product car, in the Items box you have to set:

car/yellow
car/red
car/black

and here's how it will be displayed on front when the user selects car from the first drop down list:






And if you want to add a subcategory for the second drop down list (Product Color), then, on the third drop down list, let's name it Price, you have to link it to the second drop down - Product Color and in the Items box you have to use the syntax as follows:

car/red/3
car/red/5
car/red/10






Another example of a drop down option would be to populate a drop down with a list of users from DNN and use the ID as the value displayed. Here's how you can do it:

1. put this query in the drop down Items field: select Displayname, UserId from Users (Note how the first column is the text, and the second column is the value)

Tags Input

This field allows users to type a list of keywords and an autocomplete suggestion list is displayed while typing matching values, on submit action, it will generate a comma which delimits the list of tags, in order to test this field, here's a case:

1. Add the Tags Input field on your form;

2. in Items box add a select statement (you can use as well a list of items instead of an SQL statement): e.g. Select Username, Email from Users;

3. in Limit Number of Tags you have the possibility to allow how many tags will the user be able to set in the field;

4. add a button with a Display message action and in Message box add the following tokens:


[TagsInputField]

[TagsInputField:Text]

[TagsInputField:Value] = [TagsInputField]


2. or use this query in the items field: select Firstname+' '+Lastname, UserID from Users,

Add more value with JavaScript Boolean operators

Scenario: I can dynamically show or hide multiple choice with radio boxes field by adding [fields using ID] == 'item value'. What is the JavaScript code when I want to add more item value, for example: [FieldIdxx] == "item1" || [FieldIdxx] == "item2"?

The multiple choice would save the value as item1, item2, item3, etc. In this case, you can use [FieldIdxx].indexOf('item1') != -1 || [FieldIdxx].indexOf('item2') != -1.

There's more ways to do it. You can add a console.log(form) in the General > Initialization Scripts and then check F12 console for everything that's available to you. Note that the tokens [FieldIdxx] just get replaced on the server side with form.fields.FieldIdxx.value.

Data Source: SQL query


Data Source SQL Query allows you to populate a dropdown menu with a selection of items from a database of your choice. It also allows the use of My Tokens, making it a very versatile option.

Here are some examples of queries you can use in combination with tokens:

1. select Email from Users where Email = '[User:Email]' 

2. Select '[User:Email]' from Users

with the result 



3. select username from users where email='abc@test.com'

will have as results the usernames of those user(s) who have registered with that specific email

4. select username from users where email='[User:Email]'

5. select username from users where email=[User:Email] > this is not supposed to work because [User:Email] is not in single quotations and the value which should be returned is not an ID

6. select username from users where UserId=[User:UserID]