Question type - Date/nl: Difference between revisions
From LimeSurvey Manual
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
Line 5: | Line 5: | ||
=Korte beschrijving= | =Korte beschrijving= | ||
<onlyinclude>{{#ifeq:{{{transcludesection|short_description}}}|short_description|This question type can be used to ask for a certain date | <onlyinclude>{{#ifeq:{{{transcludesection|short_description}}}|short_description|This question type can be used to ask for a certain date, for a time or a combination of date and time. Dates and times can be entered directly, chosen from a popup calendar or from drop-down boxes. For validation, minimum and maximum dates can be chosen. Various date and time formats are supported. Some of these features are only available from LimeSurvey version 2.05+. | ||
[[File:D_Date_DD.jpg]] | [[File:D_Date_DD.jpg]] | ||
Line 13: | Line 13: | ||
{{QS:mandatory/nl}} | {{QS:mandatory/nl}} | ||
{{QS:relevance/nl}} | {{QS:relevance/nl}} | ||
Line 32: | Line 30: | ||
{{QS:dropdown_dates_year_max/nl}} | {{QS:dropdown_dates_year_max/nl}} | ||
{{QS: | {{QS:date_min}} | ||
{{QS:date_max}} | |||
{{QS:em_validation_q}} | |||
{{ | |||
{{Alert| | ===Validation on date=== | ||
{{Alert||text=Dates in Limesurvey are saved as a string (text format).}} | |||
<div class="boxed">To really be able to work (and calculate) with dates, these have to be converted to a number format. The function strtotime{{NewIn|2.0|b=130515}} , which calculates the number of seconds from the 1st January 1970 to a given date can be used for this. Using strtotime() one can for example enforce that only dates before "today" are entered using the following expression: strtotime(self)<=strtotime("now"). | |||
Or enforce that that only dates after a certain date can be entered: strtotime(self)>strtotime("2013-03-27")</div> | |||
{{ | {{Alert|Please be aware that strtotime() works with a lot of different but not ALL date formats. Limesurvey's default date format (MM-DD-YYYY) does NOT work with strtotime(). Please set your survey to use one of the following date formats to avoid problems: YYYY-MM-DD, YYYY/MM/DD, DD.MM.YYYY, MM/DD/YYYY, DD-MM-YYYY.}} | ||
{{QS: | {{QS:em_validation_q_tip}} | ||
{{QS:Page_break}} | {{QS:Page_break}} |
Revision as of 15:16, 23 January 2014
Korte beschrijving
This question type can be used to ask for a certain date, for a time or a combination of date and time. Dates and times can be entered directly, chosen from a popup calendar or from drop-down boxes. For validation, minimum and maximum dates can be chosen. Various date and time formats are supported. Some of these features are only available from LimeSurvey version 2.05+.
Hoofd instellingen
Verplicht (mandatory)
Beschrijving
Met deze optie kan de enquête-beheerder instellen dat een bepaalde vraag beantwoordt moet worden voordat de deelnemer verder kan gaan met invullen. Als je een vraag hebt met subvragen en je wilt niet alle onderdelen verplicht maken, gebruik dan de optie Minimum aantal antwoorden (min_answers) op de tab Logica.
Beschikbare opties
- Aan - Vraag moet worden beantwoord voordat de deelnemer naar de volgende pagina kan - de antwoordoptie 'Geen antwoord' wordt nooit getoond.
- Zacht - Als de vraag niet wordt beantwoord, wordt een waarschuwing weergegeven wanneer wordt geprobeerd door te gaan naar de volgende pagina - de deelnemer kan er echter voor kiezen de waarschuwing te negeren en verder te gaan. Merk op dat de optie 'Geen antwoord' nog steeds wordt weergegeven (indien geactiveerd in de instellingen voor enquêtepresentatie)
- Uit (standaard) - Vraag kan onbeantwoord blijven
Conditie (eerder "Relevantievergelijking")
Beschrijving
Als de waarde van de conditie 1 of true is dan is de vraag relevant en wordt de vraag getoond bij het invullen van de enquête. En anders niet. Bij elke vraag kun je een relevantievergelijking specificeren. Dit vervangt de condities, het ondersteunt veel meer complexe logica.
Syntax markering in kleur
Wanneer je de conditie opslaat, dan wordt het geëvalueerd en met kleur gemarkeerd. De fouten worden met een kleur aangegeven waardoor je de fouten gemakkelijker ziet,
Geldige waarden
- Een conditie gebruikt de syntax die beschreven is in ExpressionScript, zonder de omringende accolades.
Voorbeelden
Voorbeelden van het met kleur markeren, oftewel syntax markering.
Speciale instellingen
Omgekeerde antwoordvolgorde (reverse)
Beschrijving
Indien geactiveerd worden de antwoordopties in de omgekeerde volgorde getoond.
Beschikbare opties
- Ja
- Nee (standaard)
Voorbeeld
Een voorbeeld met een vraag met het vraagtype Array (getallen). Indien de optie is uitgeschakeld (standaardwaarde) dan zijn de antwoorden: "1, 2, 3, ... , 10". Indien ingeschakeld zijn de beschikbare antwoorden: "10, 9, 8, ... , 1".
Randomisatiegroepsnaam (random_group)
Beschrijving
Plaatst de vragen in een randomisatiegroep waardoor de vragen in een willekeurige volgorde getoond worden aan de deelnemers.
Een voorbeeld van een enquête met deze functie staat hier.
Geldige waarden
Geef een tekst op (bijvoorbeeld: 'groep1'). Alle vragen die deze tekst bij dit veld hebben krijgen onderling een willekeurige plaats.
Preview
Als je een voorbeeld van de vragen wilt bekijken, gebruik dan het voorvertonen van de enquête in plaats van die van de vragengroep, omdat van de tweede is gemeld dat deze de vragen niet in een willekeurige volgorde zou weergeven.
Toon dropdownvelden datum (dropdown_dates)
Beschrijving
Indien ingeschakeld wijzig je de presentatie van het datum vraagtype naar dropdownvelden voor dag/maand/jaar in plaats van de standaard popup.
Beschikbare opties
- Aan
- Uit (standaard)
Voorbeeld
Indien ingeschakeld, de vraag wordt getoond als:
Beschrijving
Indien ingeschakeld wordt de vraag altijd verborgen voor de deelnemers aan de enquête. Je kunt dit gebruiken als:
- je met een URL een vraag al ingevuld toont, dan kun je met deze instelling voor zorgen dat de vraag helemaal niet getoond wordt aan de deelnemer. Deze instelling gaat voor wat met condities is ingesteld, de vraag wordt helemaal niet opgenomen op de pagina.
- je een even snel een waarde wilt bepalen of opslaan met ExpressionScript.
Beschikbare opties
- Aan
- Uit (standaard)
Minimum jaar (dropdown_dates_year_min)
Beschrijving
Met dit vraagattribuut kun je het minimum jaar instellen voor het datum vraagtype. Geldt zowel voor de weergave van de datum in dropdown velden als voor de weergave als kalender.
Geldige waarden
Elk jaar
Maximum jaar (dropdown_dates_year_max)
Beschrijving
Met dit vraagattribuut kun je het maximum jaar instellen voor het datum vraagtype. Geldt zowel voor de weergave van de datum in dropdown velden als voor de weergave als kalender.
Geldige waarden
Elk jaar
Minimum date (date_min)
Description
This question attribute can be used to set the minimum value for a date question (in y-m-d format or any English valid string - see below for more details). It can be used for both popup and dropdown display options. If a minimum date is not set, then 1.1.1900 is used as default.
Valid values
- Any date value in format YYYY-MM-DD (eg., 2017-08-24);
- Any year value;
- Any English string : "now", "-10 years", "tomorrow";
- Reference to another date/time question : AnotherDateQuestion (using the question code);
- Expressions : With expressions, a minimum date can be dynamically calculated. For example, you can use a date from a previous answer + 3 days as a minimum for the present question by entering: date("Y-m-d",strtotime(departuredate)+3*60*60*24).
Maximum date (date_max)
Description
This question attribute can be used to set the maximum value for the date question (in y-m-d format or any other English valid string - see below for more options). It can be used for both popup and dropdown display options.
Valid values
- Any date value in format YYYY-MM-DD (eg., 2018-08-24);
- Any year value;
- Any English string : "now", "-10 years", "tomorrow";
- Reference to another date/time question : AnotherDateQuestion (using the question code);
- Expressions: With expressions, a date can be dynamically calculated. For example, you can use a date from a previous answer + 3 days as a maximum date for the present question by entering: date("Y-m-d",strtotime(departuredate)+3*60*60*24).
Question validation equation (em_validation_q)
Description
This is an equation that is used to validate the entire question (e.g, all of its parts collectively for a multi-answer question). If the question fails the validation criteria, then em_validation_q_tip message will be displayed (it uses the CSS style .error). This tip uses the .em_q_fn_validation CSS style, which is hidden by default within template.css.
The main difference between this feature and the subquestion validation equations (em_validation_sq option) is that for this feature, if the question (or question parts) fail validation, then an error message could be shown. For the subquestion validation, each text entry cell (e.g., in an array question type, but it can also be applied to single entry question types) will be styled so that the background color is (light) red.
Valid values
- Any equation that makes use of the ExpressionScript syntax, without surrounding curly braces.
Example
- You want to collect demographic information from users via a multiple short text question, and you want to validate that the user has entered a valid email address and phone number.
This example shows how the question looks with invalid answers:
And here is what it looks like with one invalid answer:
Here is how you edit a question to enter that information:
And here is part of the Show Logic File output that lets you check the accuracy of your expression and ensure that there are no syntax errors:
As you can see, the validation equation tests that both the email and phone number are either empty or match a regular expression filter.
The validation tip only shows the warning message if the phone or email appears invalid.
If you wish to import the example from above into your LimeSurvey installation, download the following .lsq file: Em_validation_q_example.zip.
Validation on date
Tip for whole question validation equation (em_validation_q_tip)
Description
If you are using the question validation equation, you can use this box in order to display an optional message as question tip on how the question has to be filled out.
Valid values
- Any string or equation that makes use of the ExpressionScript syntax.
Example
See the example from the question validation equation wiki section- it shows how the tip can be tailored to show which parts of a multiple short text question fail the validation criteria.
Insert page break in printable view (page_break)
Description
This attribute is only active when you actually print a survey from the Printable View. It forces a page break before the question.
Available options
- On
- Off (default)