Actions

Tip vprašanja - Datum

From LimeSurvey Manual

This page is a translated version of the page Question type - Date and the translation is 46% complete.

Other languages:
Deutsch • ‎English • ‎español • ‎français • ‎日本語 • ‎Nederlands • ‎slovenščina

Kratek opis

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+.

D Date DD.jpg Datetime.jpg Timepicker.jpg

Glavne nastavitve

Obvezno (obvezno)

Opis

S pomočjo te nastavitve lahko določite ali mora anketiranec odgovoriti na vsa vprašanja ankete. Če ustvarite vprašanje z več podvprašanji, lahko z nastavitvijo min_answers določite, da bo anketiranec odgovoril le na določene dele ankete in ne vse.

Veljavne vrednosti

  • Da
  • Ne (privzeto)



Enačba relevantnosti

Notice.png
Hint: Ta funkcija je na voljo od različice 1.92 dalje


Opis

Vsako vprašanje vam omogoča določiti enačbo relevantnosti, ki je naslednik pogoja. Z enačbo relevantnosti lahko ustvarite veliko bolj zapleteno pogojno logiko.

Označevanje sintakse

Kadarkoli boste shranili enačbo relevantnosti, bo ovrednotena, pregledana bo tudi sintaksa enačbe. Morebitne napake bodo barvno označene, tako da jih boste lahko hitro odkrili in popravili.

Veljavne vrednosti

Vsaka enačba, ki uporablja sintakso Urejevalnika izrazov, brez zavitih oklepajev.

Primeri

Uporabni primeri: Označevanje sintakse.


Napredne nastavitve

Nasprotni vrstni red odgovorov (reverse)

Opis

Vnesene opcije odgovorov v nasprotnem vrstnem redu.

Veljavne vrednosti

  • Da
  • Ne (privzeto)



Ime naključne skupine (random_group)

Notice.png
Hint: This features is available starting in version 1.92
Important.png
Attention : The order of randmization is currently not stored. So you should not give the user an option to save/resume later. This is a limitation that will be fixed in a future version.

Opis

Vprašanje doda v skupino, kjer se vsa vprašanja prikažejo po naključnem vrstnem redu.

Veljavne vrednosti

Vnesite poljuben želen niz (na primer: 'skupina1'). Vprašanja, ki vsebujejo ta niz, bodo vključena v anketo z naključnim prikazom (=vprašanja se naključno izmenjujejo med seboj).



Prikaži spustne sezname (dropdown_dates)

Opis

Atribut spremeni prikaz tipa vprašanja Datum v spustni seznam, kjer lahko izberemo dan/mesec/leto.

Veljavne vrednosti

  • Da
  • Ne (privzeto)



Vedno skrij to vprašanje (hidden)

Opis

To nastavitev lahko uporabite, če ste nadomestili vprašanje z URL povezavo in ga anketirancu ne želite prikazati (vključno z njenimi vrednostmi). S tem se izničijo postavljeni pogoji, ki se navezujejo na to vprašanje, saj le to dejansko niti ni bilo postavljeno. Če pa želite vprašanje le skriti (na primer, če želite shraniti vrednost izračunana ***on the fly ***), potem uporabite JavaScript, ki je vgrajen v izvorno kodo vprašanja.

Notice.png
Hint: The question are not diplay in HTML, it can be set with an equation question or survey URL, but not in javascript

Available options

  • On
  • Off (default)



Minimum date (date_min) (New in 2.05 )

Description

This question attribute can be used to set the minimum value for the date question (in Y-m-d format or any English valid string) . It applies to both, the popup-variant of the calendar and the dropdown fields. Besides validation via Expression Manager, the selection of days in the popup calender is also limited accordingly. The year in popup calendar is not updated if Expression use Question in same page.

Date validation.jpg

Valid values

  • Any date value in format YYYY-MM-DD (eg., 2013-08-24)
  • Any year value
  • Any English string : "now", "-10 years", "tomorrow"
  • Reference to another date/time question : AnotherDateQuestion
  • 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) (New in 2.05 )

Description

This question attribute can be used to set the minimum value for the date question (in Y-m-d format or any English valid string) . It applies to both, the popup-variant of the calendar and the dropdown fields. Besides validation via Expression Manager, the selection of days in the popup calender is also limited accordingly. The year in popup calendar is not updated if Expression use Question in same page.

Valid values

  • Any date value in format YYYY-MM-DD (eg., 2013-08-24)
  • Any year value
  • Any English string : "now", "-10 years", "tomorrow"
  • Reference to another date/time question : AnotherDateQuestion
  • 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).



Date/Time format

Description

This question attribute can be used to specify a custom date format. If it's empty, the survey date format is used.

Valid values

The d/dd m/mm yy/yyyy H/HH M/MM formats and "-./:" characters are allowed for day/month/year/hour/minutes without or with leading zero respectively. Example are: "yyyy-mm-dd", "dd.mm.yyyy HH:MM", "HH:MM" (only ask for time) or "yyyy/mm" (only ask for month and year).




Whole question validation equation (em_validation_q)

Notice.png
Hint: This features is available starting in version 1.92


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 then em_validation_q_tip message has the CSS style .error set to it. 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 Sub-question 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 sub-question validation, each text entry cell (e.g. in array, but also applies to single entry question types) will be styled so that the background color is pink.

Valid values

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 reasonable email and phone number.

This example shows how the question looks with invalid answers:

Validation-invalid-both.jpg

And here is what it looks like with one invalid answer:

Validation-invalid-phone.jpg

Here is how you edit a question to enter that information:

Validation-gui.jpg

And here is part of the Show Logic File output that lets you validate the accuracy of your expression and ensure there are no syntax errors:

Validation-logic.jpg

As you can see, the validation equation tests that both the email and phone are either empty or match a regular expression filter.

The validation tip only shows the warning message if the phone or email appears invalid.

Please see the forum for examples: https://www.limesurvey.org/forum/can-i-do-this-with-limesurvey/111858-validate-phone-and-email-in-multiple-short-text

Notice.png
Hint: Remember, LimeSuvey uses the Perl syntax for regular expressions, so they should start and end with / (slash character)!




Tip for whole question validation equation (em_validation_q_tip)

Notice.png
Hint: This features is available starting in version 1.92


Description

If you are using em_validation_q, this is an optional message to show as a question 'tip'.

Valid values

  • Any string

Example

  • See the example for the Question validation tip - it shows how the tip can be tailored to show which parts of a multiple short text question fail validation criteria.



Sub-question validation equation (em_validation_sq)

Notice.png
Hint: This features is available starting in version 1.92


Description

This is an equation that is used to validate each sub-question (text field) individually. Any text field that does not pass these validation conditions will have its background color turned pink (using the .em_sq_fn_validation CSS style) to highlight the error. Note that this is available in addition to the regular expression-based validation option.

Valid values

Any equation, using Expression Manager syntax, without surrounding curly braces.

Examples

Say you have a multiple short text question and you want to collect email addresses. You could use the regular expression validator to make sure the email address has proper syntax.

As another example, say you only want to allow numbers that are a multiple of 3, the equation would be:

(this / 3) == floor(this/3)

The reserved variable this is automatically replaced by a reference to the active text entry cell.



Tip for sub-question validation equation (em_validation_sq_tip)

Notice.png
Hint: This features is available starting in version 1.92


Description

If you are using em_validation_sq, this is an optional message to show as a question 'tip'.

Valid values

  • Any string

Example

  • Continuing the example of validating emails, the tip might be "Please enter valid email addresses."



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. (Only the Opera browser does not need this since it handles the page breaks accordingly.)

Available options

  • Yes
  • No (default)


Dates and Expression Manager: Advanced validation and calculation

Limesurvey versions 2.05+ and above make it fairly easy to validate dates using the date_min and date_max fields (see above). Use these whenever possible. If you need to do more fancy stuff, you may be able to work (and calculate) with dates using Expression Manager and the function strtotime() (New in 2.0 build 130515). It calculates the number of seconds from the 1st January 1970 to a given date. Example: if you want to display in a question text the number of days that have passed since a departure date (asked in a previous question) and today, you can can use the expression {(strtotime("now")-strtotime(departure))/60/60/24}. 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.

Important.png
Dates in Limesurvey are saved as a string (text format).Starting in ver. 2.05+, Expression Manager converts all dates part of an expression into the standard format "yyyy-mm-dd HH:MM:SS". This makes it much easier to compare dates in an expression (e.g. "date1>date2"). If you need a datestring in the format it was asked in the question, use the ".shown" attribute (e.g.: "So you were born on the {birthdate.shown}. Is this right?")