Difference between revisions of "Template:FormDateField"
Jump to navigation
Jump to search
Line 26: | Line 26: | ||
-->{{#ifeq: {{{mandatory|}}}|yes<!-- | -->{{#ifeq: {{{mandatory|}}}|yes<!-- | ||
--><!-- year field: mandatory | --><!-- year field: mandatory | ||
− | -->|{{#vardefine: varMandatoryYear| | + | -->|{{#vardefine: varMandatoryYear||mandatory}}<!-- |
--><!-- for month and day fields the mandatory values will depend on the dataprecision parameter | --><!-- for month and day fields the mandatory values will depend on the dataprecision parameter | ||
-->{{#switch: {{{dataprecision|Day}}} <!-- | -->{{#switch: {{{dataprecision|Day}}} <!-- | ||
− | -->|Day|Month={{#vardefine: varMandatoryMonth| | + | -->|Day|Month={{#vardefine: varMandatoryMonth||mandatory}}<!-- |
-->|#default={{#vardefine: varMandatoryMonth|}}<!-- | -->|#default={{#vardefine: varMandatoryMonth|}}<!-- | ||
-->}}<!-- switch | -->}}<!-- switch | ||
-->{{#switch: {{{dataprecision|Day}}} <!-- | -->{{#switch: {{{dataprecision|Day}}} <!-- | ||
− | -->|Day={{#vardefine: varMandatoryDay| | + | -->|Day={{#vardefine: varMandatoryDay||mandatory}}<!-- |
-->|#default={{#vardefine: varMandatoryDay|}}<!-- | -->|#default={{#vardefine: varMandatoryDay|}}<!-- | ||
-->}}<!-- switch | -->}}<!-- switch | ||
Line 61: | Line 61: | ||
--><!-- | --><!-- | ||
--><!-- show era if necessary | --><!-- show era if necessary | ||
− | -->{{#ifeq: {{{showera|}}}|yes|{{#ifeq: {{{showcaptions|yes}}}|yes|''Era:'' |}}{{{field | + | -->{{#ifeq: {{{showera|}}}|yes|{{#ifeq: {{{showcaptions|yes}}}|yes|''Era:'' |}}{{{field|{{{property|}}} Era|input type=dropdown|values=BCE,CE{{#ifeq:{{{adddefault|}}}|yes||default=CE|}}{{#var:varMandatoryYear}}}}}|}}<!-- |
--><!-- | --><!-- | ||
--><!-- build the regular expression for the year field | --><!-- build the regular expression for the year field | ||
Line 69: | Line 69: | ||
-->}}<!-- | -->}}<!-- | ||
--><!-- | --><!-- | ||
− | --> {{#ifeq:{{{showcaptions|yes}}}|yes|''Year:'' |}}{{{field|{{{property|}}} Year|input type=regexp|regexp={{#var:varRegexp}}|size=4|message=The year field can accept only integers and must be 4 digits in length!{{#ifeq:{{{adddefault|}}}|yes| | + | --> {{#ifeq:{{{showcaptions|yes}}}|yes|''Year:'' |}}{{{field|{{{property|}}} Year|input type=regexp|regexp={{#var:varRegexp}}|size=4|message=The year field can accept only integers and must be 4 digits in length!{{#ifeq:{{{adddefault|}}}|yes||default={{CURRENTYEAR}}|}}{{#var:varMandatoryYear}}}}}<!-- |
--><!-- | --><!-- | ||
--><!-- | --><!-- | ||
Line 78: | Line 78: | ||
--><!-- | --><!-- | ||
-->{{#ifeq: {{#var:varMonthVisible}}|yes|<!-- | -->{{#ifeq: {{#var:varMonthVisible}}|yes|<!-- | ||
− | --> {{#ifeq: {{{showcaptions|yes}}}|yes|''Month:'' |}}{{{field | + | --> {{#ifeq: {{{showcaptions|yes}}}|yes|''Month:'' |}}{{{field|{{{property|}}} Month|input type=dropdown|values=January,February,March,April,May,June,July,August,September,October,November,December{{#ifeq:{{{adddefault|}}}|yes||default={{CURRENTMONTHNAME}}|}}{{#var:varMandatoryMonth}} }}}<!-- |
--><!-- | --><!-- | ||
-->{{#ifeq: {{#var:varDayVisible}}|yes|<!-- | -->{{#ifeq: {{#var:varDayVisible}}|yes|<!-- | ||
− | --> {{#ifeq: {{{showcaptions|yes}}}|yes|''Day:'' |}}{{{field | + | --> {{#ifeq: {{{showcaptions|yes}}}|yes|''Day:'' |}}{{{field|{{{property|}}} Day|input type=dropdown|values=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31{{#ifeq:{{{adddefault|}}}|yes||default={{CURRENTDAY}}|}}{{#var:varMandatoryDay}}}}}<!-- |
-->}}<!-- ifeq day | -->}}<!-- ifeq day | ||
--><!-- | --><!-- | ||
-->}}<!-- ifeq month | -->}}<!-- ifeq month | ||
--><!-- | --><!-- | ||
− | -->{{#ifeq: {{{showapproximate|}}}|yes| {{#ifeq: {{{showcaptions|yes}}}|yes|''Approximate?'' |}}{{{field | + | -->{{#ifeq: {{{showapproximate|}}}|yes| {{#ifeq: {{{showcaptions|yes}}}|yes|''Approximate?'' |}}{{{field|{{{property|}}} Approximate|input type=checkbox}}}|}}<!-- show approximate if necessary |
--><!-- | --><!-- | ||
--><!-- | --><!-- | ||
--><!-- | --><!-- | ||
--></includeonly> | --></includeonly> |
Revision as of 15:28, 31 May 2020
This template is called from within Semantic Forms to display a Date field.
NOTE: This is a "form" template; it should NOT be called from anywhere except a semantic form.
It creates the following entry fields:
{{{property|}}} Era
- CE or BCE; the default is CE.{{{property|}}} Year
- the year field; accepts 4 integers.{{{property|}}} Month
- the month field.{{{property|}}} Day
- the day field.{{{property|}}} Approximate
- if day field.
Parameters:
|property=
- the name of the property; must be unique for the form. The template will use this value to create several fields ending with Year, Month, Day, etc.|mandatory=
- if yes, then the combined field return some value. The default is no.|dataprecision=
- Year, Month, or Day. Depending on this parameter, the respective fields will be made mandatory. The default is Day.|showera=
- if yes, then the era will be show; if no (default), then the era field will not be shown and the value of CE will be set automatically.|showapproximate=
- if yes, the approximate field will be shown; if no (default), then the approximate field will not be shown and the date will be considered not approximate (i.e. precise).|showmonthdayfields=
- if yes (default), the Month and Day fields will be shown even if dataprecision=Year. If no, the Month and Day fields will only be shown if necessary.|showcaptions=
- if yes (default), the captions (Year, Month etc.) will be shown.|adddefualt=
- if yes, the date fields will have the value of now by default. If no (default), no default will be added to the fields.