Difference between revisions of "Template:FormDateField"

From Encyclopedia of Scientonomy
Jump to navigation Jump to search
Line 26: Line 26:
 
-->{{#ifeq: {{{mandatory|}}}|yes<!--  
 
-->{{#ifeq: {{{mandatory|}}}|yes<!--  
 
  --><!-- year field: mandatory  
 
  --><!-- year field: mandatory  
  -->|{{#vardefine: varMandatoryYear|&#124;mandatory}}<!--  
+
  -->|{{#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|&#124;mandatory}}<!--  
+
   -->|Day|Month={{#vardefine: varMandatoryMonth||mandatory}}<!--  
 
   -->|#default={{#vardefine: varMandatoryMonth|}}<!--  
 
   -->|#default={{#vardefine: varMandatoryMonth|}}<!--  
 
   -->}}<!-- switch  
 
   -->}}<!-- switch  
 
   -->{{#switch: {{{dataprecision|Day}}} <!--  
 
   -->{{#switch: {{{dataprecision|Day}}} <!--  
   -->|Day={{#vardefine: varMandatoryDay|&#124;mandatory}}<!--  
+
   -->|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:''&#32;|}}{{{field&#124;{{{property|}}} Era&#124;input type=dropdown&#124;values=BCE,CE{{#ifeq:{{{adddefault|}}}|yes|&#124;default=CE|}}{{#var:varMandatoryYear}}}}}|}}<!--  
+
-->{{#ifeq: {{{showera|}}}|yes|{{#ifeq: {{{showcaptions|yes}}}|yes|''Era:''&#32;|}}{{{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:
 
-->}}<!--  
 
-->}}<!--  
 
--><!--  
 
--><!--  
-->&#32;{{#ifeq:{{{showcaptions|yes}}}|yes|''Year:''&#32;|}}{{{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|&#124;default={{CURRENTYEAR}}|}}{{#var:varMandatoryYear}}}}}<!--
+
-->&#32;{{#ifeq:{{{showcaptions|yes}}}|yes|''Year:''&#32;|}}{{{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|<!--  
  -->&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Month:''&#32;|}}{{{field&#124;{{{property|}}} Month&#124;input type=dropdown&#124;values=January,February,March,April,May,June,July,August,September,October,November,December{{#ifeq:{{{adddefault|}}}|yes|&#124;default={{CURRENTMONTHNAME}}|}}{{#var:varMandatoryMonth}} }}}<!--
+
  -->&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Month:''&#32;|}}{{{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|<!--  
   -->&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Day:''&#32;|}}{{{field&#124;{{{property|}}} Day&#124;input type=dropdown&#124;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|&#124;default={{CURRENTDAY}}|}}{{#var:varMandatoryDay}}}}}<!--
+
   -->&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Day:''&#32;|}}{{{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|&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Approximate?''&#32;|}}{{{field&#124;{{{property|}}} Approximate&#124;input type=checkbox}}}|}}<!-- show approximate if necessary
+
-->{{#ifeq: {{{showapproximate|}}}|yes|&#32;{{#ifeq: {{{showcaptions|yes}}}|yes|''Approximate?''&#32;|}}{{{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.