Difference between revisions of "URL form field type"

From Joomla! Documentation

(Marked this version for translation)
(space deleted)
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
JStringPunycode::urlToUTF8($this->contact->webpage)
 
JStringPunycode::urlToUTF8($this->contact->webpage)
 
</source>.
 
</source>.
 
 
<translate><!--T:2-->
 
<translate><!--T:2-->
 
* '''type''' (mandatory) must be ''url''.</translate>
 
* '''type''' (mandatory) must be ''url''.</translate>
Line 45: Line 44:
 
</translate>
 
</translate>
  
[<noinclude>
+
<noinclude>
 
<translate>
 
<translate>
 
<!--T:18-->
 
<!--T:18-->
[Category:Standard form field types]]
+
[[Category:Standard form field types]]
 
</translate>
 
</translate>
 
</noinclude>
 
</noinclude>

Revision as of 12:24, 9 August 2015

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

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]