CIForms examples

From Wikisphere
Jump to navigation Jump to search
Subpages:

Basic, one column[edit | edit source]

This is the simplest form (type "inputs" by default, one column)

The square brackets represent an input, the square brackets contain the input type, the asterisk indicates a mandatory field

{{#CI form: title = Contact form
| type = inputs
| first and last name [] *
| email [email] *
| your message [textarea]  *
}}

which produces the following


{{#CI form: title = Contact form | type = inputs | submission groups = sysop | first and last name [] * | email [email] * | your message [textarea] * }}


Placeholders[edit | edit source]

Form with placeholders. The square brackets contain the placeholder and optionally the input type after the equal symbol:

{{#CI form: title = Contact form
| [first and last name] *
| [email=email] *
| [phone=tel]
| [your message=textarea]  *
}}


which produces the following:


{{#CI form: title = Contact form | [first and last name] * | [email=email] * | [phone=tel] | [your message=textarea] * }}


Two columns[edit | edit source]

Inputs responsive (two columns), the square brackets contain the input type, the form rows can contain html (the label of the email input is bold)


{{#CI form: title = Contact form
| type = inputs responsive
| submit = abc@test.com
| first name [] *
| last name [] *
| <b>email</b> [email] *
| phone [tel]
| your message [textarea]  *
}}


{{#CI form: title = Contact form | type = inputs responsive | first name [] * | last name [] * | email [email] * | phone [tel] | your message [textarea] * }}


Multiple choice[edit | edit source]

Multiple choice with arbitrary text inputs between answers (on the last line in the example)

{{#CI form: title = Why are you applying to this job ?
| type = multiple choice 
| I send bulk applications, even if I will be selected I'm not sure to confirm
| I ran out of money, I have to find whatever job quickly
| I want to learn something new 
| The job fits my background and I'm very skilled, I look forward to join your team!
| Let me explain [] 
}}


{{#CI form: title = Why are you applying to this job ? | type = multiple choice | I send bulk applications, even if I will be selected I'm not sure to confirm | I ran out of money, I have to find whatever job quickly | I want to learn something new | The job fits my background and I'm very skilled, I look forward to join your team! | Let me explain [] }}



Select[edit | edit source]

Select with placeholder and hardcoded options. An option contain a comma? Just escape it!

{{#CI form: title = Select your preferred IT course
| type = inputs
| [Please chose one=select=PHP and Mysql, Node.js\, Vue.js\, React, Mediawiki and Gerrit ] *
}}


{{#CI form: title = Select your preferred IT course | type = inputs | [Please chose one=select=PHP and Mysql, Node.js\, Vue.js\, React, Mediawiki and Gerrit ] * }}



Select with combobox[edit | edit source]

Select populated by wikitext (if the select contains more than 20 options CIForms will automatically display it as a select2 combobox)

{{#CI form: title = Country and city
| type = inputs
| country [select={{#replace:{{Template:Countries}}|*|,}}] *
| city [] *
}}


{{#CI form: title = Country and city | type = inputs | country [select=, Afghanistan , Aland Islands , Albania , Algeria , American Samoa , Andorra , Angola , Anguilla , Antarctica , Antigua And Barbuda , Argentina , Armenia , Aruba , Australia , Austria , Azerbaijan , Bahrain , Bangladesh , Barbados , Belarus , Belgium , Belize , Benin , Bermuda , Bhutan , Bolivia , Bonaire, Sint Eustatius and Saba , Bosnia and Herzegovina , Botswana , Bouvet Island , Brazil , British Indian Ocean Territory , Brunei , Bulgaria , Burkina Faso , Burundi , Cambodia , Cameroon , Canada , Cape Verde , Cayman Islands , Central African Republic , Chad , Chile , China , Christmas Island , Cocos (Keeling) Islands , Colombia , Comoros , Congo , Cook Islands , Costa Rica , Cote D'Ivoire (Ivory Coast) , Croatia , Cuba , Curaçao , Cyprus , Czech Republic , Democratic Republic of the Congo , Denmark , Djibouti , Dominica , Dominican Republic , East Timor , Ecuador , Egypt , El Salvador , Equatorial Guinea , Eritrea , Estonia , Ethiopia , Falkland Islands , Faroe Islands , Fiji Islands , Finland , France , French Guiana , French Polynesia , French Southern Territories , Gabon , Gambia The , Georgia , Germany , Ghana , Gibraltar , Greece , Greenland , Grenada , Guadeloupe , Guam , Guatemala , Guernsey and Alderney , Guinea , Guinea-Bissau , Guyana , Haiti , Heard Island and McDonald Islands , Honduras , Hong Kong S.A.R. , Hungary , Iceland , India , Indonesia , Iran , Iraq , Ireland , Israel , Italy , Jamaica , Japan , Jersey , Jordan , Kazakhstan , Kenya , Kiribati , Kosovo , Kuwait , Kyrgyzstan , Laos , Latvia , Lebanon , Lesotho , Liberia , Libya , Liechtenstein , Lithuania , Luxembourg , Macau S.A.R. , Madagascar , Malawi , Malaysia , Maldives , Mali , Malta , Man (Isle of) , Marshall Islands , Martinique , Mauritania , Mauritius , Mayotte , Mexico , Micronesia , Moldova , Monaco , Mongolia , Montenegro , Montserrat , Morocco , Mozambique , Myanmar , Namibia , Nauru , Nepal , Netherlands , New Caledonia , New Zealand , Nicaragua , Niger , Nigeria , Niue , Norfolk Island , North Korea , North Macedonia , Northern Mariana Islands , Norway , Oman , Pakistan , Palau , Palestinian Territory Occupied , Panama , Papua new Guinea , Paraguay , Peru , Philippines , Pitcairn Island , Poland , Portugal , Puerto Rico , Qatar , Reunion , Romania , Russia , Rwanda , Saint Helena , Saint Kitts And Nevis , Saint Lucia , Saint Pierre and Miquelon , Saint Vincent And The Grenadines , Saint-Barthelemy , Saint-Martin (French part) , Samoa , San Marino , Sao Tome and Principe , Saudi Arabia , Senegal , Serbia , Seychelles , Sierra Leone , Singapore , Sint Maarten (Dutch part) , Slovakia , Slovenia , Solomon Islands , Somalia , South Africa , South Georgia , South Korea , South Sudan , Spain , Sri Lanka , Sudan , Suriname , Svalbard And Jan Mayen Islands , Swaziland , Sweden , Switzerland , Syria , Taiwan , Tajikistan , Tanzania , Thailand , The Bahamas , Togo , Tokelau , Tonga , Trinidad And Tobago , Tunisia , Turkey , Turkmenistan , Turks And Caicos Islands , Tuvalu , Uganda , Ukraine , United Arab Emirates , United Kingdom , United States , United States Minor Outlying Islands , Uruguay , Uzbekistan , Vanuatu , Vatican City State (Holy See) , Venezuela , Vietnam , Virgin Islands (British) , Virgin Islands (US) , Wallis And Futuna Islands , Western Sahara , Yemen , Zambia , Zimbabwe] * | city [] * }}

attention: in order for this example to work, $wgPFEnableStringFunctions and $wgPFStringLengthLimit must be set respectively to true and to an high value (for instance 10000) in your LocalSettings.php, and Template:Countries must exist

Nested sections[edit | edit source]

Form with nested sections. The multiple choice accepts up to 3 answers ("max answers=3") The textarea has a maxlength attribute ("[textarea=1000]")

{{#CI form: title = Job application
| submission groups = sysop
|
{{#CI form section: type = inputs 
| name [] *
| email [] *
}}
|
{{#CI form section: type = inputs
| title = What about your motivation ?
| type = multiple choice
| I send bulk application, even if I will be selected I'm not sure to confirm
| I ran out of money, I have to find whatever job quickly
| I want to learn something new 
| The job fits my background and I'm very skilled, I look forward to join your team!
| Let me explain [] 
}}

{{#CI form section: type = multiple choice
| title = If you will be selected (on the basis of the answer above), how will you undertake your work ? (up to 3 answers allowed)
| type = multiple choice
| max answers=3
| I will work scrupulously
| I will work meticulously
| I will pretend to work
| I will delegate all my work to my sister
| I will work seriously 
}}

{{#CI form section: type = inputs
|title = Please describe yourself
| [required=textarea=1000] *
}}

}}


{{#CI form: title = Job application | submission groups = sysop | {{#CI form section: type = inputs | name [] * | email [] * }} | {{#CI form section: type = inputs | title = What about your motivation ? | type = multiple choice | I send bulk application, even if I will be selected I'm not sure to confirm | I ran out of money, I have to find whatever job quickly | I want to learn something new | The job fits my background and I'm very skilled, I look forward to join your team! | Let me explain [] }}

{{#CI form section: type = multiple choice | title = If you will be selected (on the basis of the answer above), how will you undertake your work ? (up to 3 answers allowed) | type = multiple choice | max answers=3 | I will work scrupulously | I will work meticulously | I will pretend to work | I will delegate all my work to my sister | I will work seriously }}

{{#CI form section: type = inputs |title = Please describe yourself | [required=textarea=1000] * }}


}}

Steps & surveys[edit | edit source]

Inspired by https://demo.limesurvey.org/index.php?r=survey/index&sid=14272

(css used Template:CIForms_examples/styles.css using the paramter css-class)

{{#CI form: title = Survey example | email-to = abc@mail.com | paging = 4 | css-class = form-limesurvey |

{{#CI form section: type = inputs responsive | first and last name [] * | email [email] | phone [tel] }}

{{#CI form section: type = multiple choice | list-type = none | max answers = 1 | title = 2. How much do you like CIForms ? | 1 | 2 | 3 | 4 | 5 | No answer }}


{{#CI form section: type = input | title = 3. What is your favorite pastime? |[Please chose one=select=Reading,Programming,Navigating the web,All of the above,Other,No answer] * | (if you selected "other") [text] }}


{{#CI form section: type = multiple choice | list-type = none | max answers = 1 | title = 4. What is your favorite color ? | Red | Orange | Yellow | Green | Blue | Indigo | Violet | Plaid | Other [] | No answer }}

{{#CI form section: type = multiple choice | title = 5. Who is your favorite relative ? | Father | Mother | Sister | Brother | Uncle | Aunt | Grandfather | Grandmother | No answer }}

{{#CI form section: type = inputs | title = Why ? | [textarea] }}

{{#CI form section: type = inputs | title = 6. How much do you like these foods ? | Broccoli [Chose one=select=Hate,Dislike,Ambivalent,Like,Love,No answer] | Ice Cream [Chose one=select=Hate,Dislike,Ambivalent,Like,Love,No answer] | Chocolate [Chose one=select=Hate,Dislike,Ambivalent,Like,Love,No answer] | Steak [Chose one=select=Hate,Dislike,Ambivalent,Like,Love,No answer] | Escargot [Chose one=select=Hate,Dislike,Ambivalent,Like,Love,No answer] }}

{{#CI form section: type = inputs | title = 7. How much pain to you currently feel in the following locations? 1 = none, 10 = extreme | Head [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] * Torso [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] | Back [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] Seat [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] | Hands [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] Feet [Chose one=select=1,2,3,5,6,7,8,9,10,No answer] }}


{{#CI form section: type = inputs | title = 8. How much do you like the following? (1 = not at all, 5 = extremely) | Ballet [Chose one=select=1,2,3,5,No answer] Jazz [Chose one=select=1,2,3,5,No answer] | Ballroom [Chose one=select=1,2,3,5,No answer] Tap [Chose one=select=1,2,3,5,No answer] | Contemporary [Chose one=select=1,2,3,5,No answer] Hip Hop [Chose one=select=1,2,3,5,No answer] }}

{{#CI form section: type = inputs | title = 9. How should the following change? | Funding for education [Chose one=select=Increase, Same, Decrease,No answer] Funding for security (e.g. police, jails, military) [Chose one=select=Increase, Same, Decrease,No answer] | Availability of high quality health care [Chose one=select=Increase, Same, Decrease,No answer] | Compensation for teachers [Chose one=select=Increase, Same, Decrease,No answer] Compensation for executives [Chose one=select=Increase, Same, Decrease,No answer] | Taxes on the rich [Chose one=select=Increase, Same, Decrease,No answer] Taxes on you [Chose one=select=Increase, Same, Decrease,No answer] }}

{{#CI form section: type = inputs responsive | title = 10. How long should it take to fix the following? | All bugs in LimeSurvey 1.91+ [Chose one=select=1,2,3,4,5,6,7,8,9,10] [Chose one=select=days,weeks,years] | All items on your To Do list [Chose one=select=1,2,3,4,5,6,7,8,9,10] [Chose one=select=days,weeks,years] | All items on your 'honey-do' list [Chose one=select=1,2,3,4,5,6,7,8,9,10] [Chose one=select=days,weeks,years] | The economy [Chose one=select=1,2,3,4,5,6,7,8,9,10] [Chose one=select=days,weeks,years] }}


{{#CI form section: type = cloze test | list-type = none | title = 11. Who are your favorite characters in the following? |

<html>

FavoriteSecond mostThird most
Harry Potter[][][]
Star Trek[][][]
Star Wars[][][]

</html>

}}

{{#CI form section: type = inputs responsive | title = 12. Which of the following conditions have you had? | cancer [Chose one=select=Yes,Uncertain,No,No answer] | heart attack [Chose one=select=Yes,Uncertain,No,No answer] | diabetes [Chose one=select=Yes,Uncertain,No,No answer] | obesity [Chose one=select=Yes,Uncertain,No,No answer] | depression [Chose one=select=Yes,Uncertain,No,No answer] }}

{{#CI form section: type = inputs responsive | title = 13. How tall are the following? | Short [Chose one=select=House,Ferris Wheel (not including the London Eye),U.S. Capitol building,Washington Monument,Empire State Building] | Medium [Chose one=select=House,Ferris Wheel (not including the London Eye),U.S. Capitol building,Washington Monument,Empire State Building] | Tall [Chose one=select=House,Ferris Wheel (not including the London Eye),U.S. Capitol building,Washington Monument,Empire State Building] | No answer [Chose one=select=House,Ferris Wheel (not including the London Eye),U.S. Capitol building,Washington Monument,Empire State Building] }}

{{#CI form section: type = inputs responsive | title = 14. For each of these issues, how severe and bothersome are they? | Financial woes [Chose one=select=Mild Severity,Moderate Severity,Extreme Severity,Mild Bothersomeness,Moderate Bothersomeness,Extreme Bothersomeness,No answer] | Health concerns [Chose one=select=Mild Severity,Moderate Severity,Extreme Severity,Mild Bothersomeness,Moderate Bothersomeness,Extreme Bothersomeness,No answer] | Ability to get your doctors to listen [Chose one=select=Mild Severity,Moderate Severity,Extreme Severity,Mild Bothersomeness,Moderate Bothersomeness,Extreme Bothersomeness,No answer] }}

{{#CI form section: type = inputs | title = 15. When was your most recent birthday? | [date] }}

{{#CI form section: type = inputs | title = 16. Please upload a picture (not supported) }}

{{#CI form section: type = multiple choice | title = 17. What gender are you? | female {{#fas:venus}} | male {{#fas:mars}} | no answer {{#fas:genderless}} }}


{{#CI form section: type = inputs | title = 18. Pick a new language | [Choose your language=select=,Afrikaans ,Albanian ,Arabic ,Armenian ,Basque ,Bengali ,Bulgarian ,Catalan ,Cambodian ,Chinese (Mandarin) ,Croatian ,Czech ,Danish ,Dutch ,English ,Estonian ,Fiji ,Finnish ,French ,Georgian ,German ,Greek ,Gujarati ,Hebrew ,Hindi ,Hungarian ,Icelandic ,Indonesian ,Irish ,Italian ,Japanese ,Javanese ,Korean ,Latin ,Latvian ,Lithuanian ,Macedonian ,Malay ,Malayalam ,Maltese ,Maori ,Marathi ,Mongolian ,Nepali ,Norwegian ,Persian ,Polish ,Portuguese ,Punjabi ,Quechua ,Romanian ,Russian ,Samoan ,Serbian ,Slovak ,Slovenian ,Spanish ,Swahili ,Swedish ,Tamil ,Tatar ,Telugu ,Thai ,Tibetan ,Tonga ,Turkish ,Ukrainian ,Urdu ,Uzbek ,Vietnamese ,Welsh ,Xhosa] }}

{{#CI form section: type = inputs responsive | title = 19. How old are the following people (or how old were they when they died)? | Yourself [number] | Your mother [number] | Your father [number] }}

{{#CI form section: type = inputs responsive | title = 20. How old are you? | [number] }}

{{#CI form section: type = cloze test | css-class= ciform-favorite-activities | title = 21. Please rate your favorite activities: | [] Sleeping | [] Programming | [] Watching television | [] Time with family }}

{{#CI form section: type = inputs | title = 22. This is just a text display. Is the rendered value saved anywhere? Is there a database field for it (e.g. to emulate the Equation question type)? }}

{{#CI form section: type = multiple choice | title = 23. Do you love CIForms ? | yes {{#fas:check}} | no {{#fas:ban}} | no answer {{#far:circle}} }}

{{#CI form section: type = inputs | title = 24. Please paste your resume | [textarea] }}

{{#CI form section: type = inputs | title = 25. (let's skip this) }}

{{#CI form section: type = cloze test | list-type = none | title = 26. What are the names of your best friends? | Favorite Friend [] | Favorite Family Member [] | Favorite Co-Worker [] }}

{{#CI form section: type = inputs | title = 27. What is your favorite food ? | [] }}

{{#CI form section: type = multiple choice | title = 28. Where would you like to vacation this year? | Hawaii | Bahamas | Europe | New Zealand }}

{{#CI form section: type = multiple choice | max answers = 3 | title = 29. Which of the following do you like? Please comment why or why not for each. | Junk Food [] | Reality TV [] | Excercise [] }}


}}

Cloze test[edit | edit source]

Cloze tests are mainly used to administer quizzes and tests.

Square brackets represent an input, a square bracket with text inside represents a suggestion. The asterisk represents an example sentence. Each row can contain an arbitrary number of inputs.

{{#CI form: type = cloze test 
| title = Put the verbs between parentheses in the proper tense
| * I (to be) [have been] proud to win the match
| I (to do) [] a wonderful work
| I (to drink) [] too much at the last party
| I (to eat) [] 3 pizzas and 4 portions of french fries, and now I don't perform really well in intimate situations
| (to make) We are such stuff as dreams are [] on; and our little life ...
}}

{{#CI form: type = cloze test | title = Put the verbs between parentheses in the proper tense | * I (to be) [have been] proud to win the match | I (to do) [] a wonderful work | I (to drink) [] too much at the last party | I (to eat) [] 3 pizzas and 4 portions of french fries, and now I don't perform really well in intimate situations | (to make) We are such stuff as dreams are [] on; and our little life ... }}

Cloze test with suggestions[edit | edit source]

The list of suggestions is automatically shuffled and the suggestion is automatically canceled from the list. (line-through)

{{#CI form: type = cloze test 
| title = Put the right word in each sentence
| suggestions = pencils, cats, dogs, car, house, pizzas
| * There are three [pencils] on my table
| My [] is pretty fast
| My [] barks a lot but welcomes thieves equipped with sausages
| I love [] because they say "meeeooow"
| I'm able to eat 4 [] at any time
| My [] has 3 swimming pools and a bowling lane, are you envious ?
}}

{{#CI form: type = cloze test | title = Put the right word in each sentence | suggestions = pencils, cats, dogs, car, house, pizzas | * There are three [pencils] on my table | My [] is pretty fast | My [] barks a lot but welcomes thieves equipped with sausages | I love [] because they say "meeeooow" | I'm able to eat 4 [] at any time | My [] has 3 swimming pools and a bowling lane, are you envious ? }}


Cloze test with transformed suggestions[edit | edit source]

In some cases the answer has to be "transformed" with regard of the list of suggestions. In this case the relationship is expressed with the equal symbol within square brackets.

{{#CI form: type = cloze test 
| title = Chose the right verb for each sentence and put it in the proper tense
| suggestions = to be, to win, to do, to drink, to make
| list-type = letters
| * I [to be=have been] proud to win the match
| I [] a wonderful work
| I [] too much at the last party
| I [] 3 pizzas and 4 portions of french fries, and now I don't perform really well in intimate situations
| We are such stuff as dreams are [] on; and our little life ...
}}

{{#CI form: type = cloze test | title = Chose the right verb for each sentence and put it in the proper tense | suggestions = to be, to win, to do, to drink, to make | list-type = letters | * I [to be=have been] proud to win the match | I [] a wonderful work | I [] too much at the last party | I [] 3 pizzas and 4 portions of french fries, and now I don't perform really well in intimate situations | We are such stuff as dreams are [] on; and our little life ... }}

Cloze tests with html[edit | edit source]

The following is a quiz adapted from this page

{{#CI form: title = Complete the text from the Wikipedia article on [https://en.wikipedia.org/wiki/Aristotle Aristotle]
| type = cloze test
| list-type = none
| suggestions =  Athens, Nicomachus, eighteen, 347, Stageira, Phaestis, Plato
| <b>Early Years</b> <br> Aristotle was born in [Stageira] in Chalcidice. His parents were []  and [], who became physician to King Amyntas of Macedon. <br> Aristotle was educated as a member of the aristocracy. At about the age of [], he went to [] to continue his education at []'s Academy for nearly twenty years, not leaving until after 
Plato's death in [] BC. 
}}


{{#CI form: title = Complete the text from the Wikipedia article on Aristotle | type = cloze test | list-type = none | suggestions = Athens, Nicomachus, eighteen, 347, Stageira, Phaestis, Plato | Early Years
Aristotle was born in [Stageira] in Chalcidice. His parents were [] and [], who became physician to King Amyntas of Macedon.
Aristotle was educated as a member of the aristocracy. At about the age of [], he went to [] to continue his education at []'s Academy for nearly twenty years, not leaving until after Plato's death in [] BC. }}