URL form field type

From Joomla! Documentation

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎español • ‎français

This field essentially is a text field with the type of url. If a fully qualified url (that is one with a scheme and domain such as http://example.com) is entered and it uses idn (that is uses characters that are non ascii such as ê or Ψ) it will translate the url into punycode prior to saving. This ensures that the url will work as intended regardless of environment. If you want to render field data in idn you should wrap it with the conversion method :

JStringPunycode::urlToUTF8($this->contact->webpage)

.

  • type (mandatory) must be url.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • size (optional) is the width of the text box in characters. If omitted the width is determined by the browser. The value of size does not limit the number of characters that may be entered.
  • maxlength (optional) limits the number of characters that may be entered.
  • default (optional) (not translatable) is the default value.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • class (optional) is a CSS class name for the HTML form field. If omitted this will default to 'text_area'.
  • readonly (optional) The field cannot be changed and will automatically inherit the default value.
  • disabled (optional) The field cannot be changed and will automatically inherit the default value - it will also not submit.
  • required (optional) The field must be filled before submitting the form.
  • filter (optional) allow the system to save certain html tags or raw data.
  • validate (optional) makes a validation
  • relative (optional) set to true for relative URLs
  • hint (optional) The text displayed in the html placeholder element, usually a lighter coloured hint displayed inside a blank field

Example XML field definition:

<field name="mytextvalue" type="url" default="http://www.example.com" label="Enter a URL" description="" size="10" />

Both a url rule and a url input filter can assist with this insuring that valid url data are entered into this field field.

See also[edit]