Campo de Formulario, Tipo calendar

From Joomla! Documentation

Revision as of 16:37, 4 September 2015 by Abulafia (talk | contribs)
Other languages:
Bahasa Indonesia • ‎Deutsch • ‎English • ‎Nederlands • ‎español • ‎français • ‎italiano • ‎हिन्दी

Proporciona un cuadro de texto para la entrada de una fecha. Un icono situado junto al cuadro de texto proporciona un enlace a un calendario emergente, que también puede ser utilizado para introducir el valor de la fecha. Si el campo tiene un valor guardado este se muestra en el campo de texto. De lo contrario, se muestra el valor predeterminado, si hay alguno.

Params.calendar.jpg
  • type (obligatorio) debe ser calendar.
  • name (obligatorio) es el nombre único del parámetro.
  • label (obligatorio) (traducible) es el título descriptivo del campo.
  • default (opcional) es el valor predeterminado de la fecha. Esta debe ser dada en el mismo formato que el especificado por el argumento formato. Puede poner "NOW" para tener la información de la fecha u hora del momento en el formato establecido.
  • description (opcional) (traducible) es el texto que será mostrado como un texto de ayuda cuando el usuario mueve el ratón sobre el cuadro de texto.
  • readonly (opcional) indica si el cuadro de texto de sólo lectura (true o false). Si el cuadro de texto es de sólo lectura, la fecha no se puede cambiar, pero se puede seleccionar y copiar. No hay icono de calendario.
  • disabled (opcional) indica si el cuadro de texto está desactivado (true o false). Si el cuadro de texto está desactivado, la fecha no puede ser cambiada, seleccionada o copiada.
  • class (opcional) es un nombre de clase CSS para el campo del formulario HTML.
  • formato (opcional) es el formato de fecha a ser utilizado. Este es el formato utilizado por PHP para especificar el formato de cadenas de fechas (ver más abajo). Si no se da ningún argumento al formato, se supone '%Y-%m-%d' (dando fechas como '2008-04-16').
  • 'filter (opcional) es el la zona horaria a ser utilizada. Hay dos valores; server_utc y user_utc. El primero es la zona horaria del servidor y el segundo es la zona horaria del usuario, según este configurado en la configuración global y la información del usuario, respectivamente.

Ejemplo XML de definición de campo:

<field name="mycalendar" type="calendar" default="5-10-2008" label="Select a date" description="" format="%d-%m-%Y" />

The format attribute specifies the format that the date string will be saved in. It is also the format that manually entered dates need to be enterered in; except that the punctuation character is ignored. The coding scheme used to specify date formats is a custom one defined for the javascript library used in the datepicker, full details of which can be found for example on Joomla's Github. The following are some of the most frequently used date string codes:

Character Description Example
d Day of the month, 2 digits with leading zeros 01 to 31
a A textual representation of a day, three letters Mon through Sun
e Day of the month without leading zeros 1 to 31
A A full textual representation of the day of the week Monday through Sunday
w Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
j The day of the year (starting from 0) 001 through 366
B A full textual representation of a month January through December
m Numeric representation of a month, with leading zeros 01 through 12
b A short textual representation of a month, three letters Jan through Dec
Y A full numeric representation of a year, 4 digits 1999 or 2003
y A two-digit representation of a year 99 or 03
p Lowercase Ante Meridiem or Post Meridiem am or pm
P Uppercase Ante Meridiem or Post Meridiem AM or PM

Note: The format in which dates are stored in the params.ini file is that specified by the format argument. Since there can be language-dependent elements to this format (for example, the '%A' specifier), you need to be careful not to use such elements if there is a possibility that the front-end and back-end languages may be different.

Note: The calendar form field type does not support non-Gregorian calendars. If you need to support non-Gregorian calendars then you will need to create a custom form field type to support your calendar.

Standard associated filters

  • user_utc - Calculates the specified value to the time of Greenwich, according to the user time zone settings.

See also