15

I see intermittent use of filter="safehtml" and filter="string" throught Joomla forms. Is there a complete list, and can custom filters be created?

1
  • FYI: The JForm filters are now in /libraries/src/Form/Form.php method filterField
    – bertmert
    Jul 1, 2018 at 16:16

1 Answer 1

21

The possible filters are:

  • rules (Access Control Rules)
  • unset (Do nothing, thus leaving the return value as null)
  • raw (No filter)
  • int_array (Filter the input as an array of integers)
  • safehtml (Filter safe HTML)
  • server_utc (Convert a date to UTC based on the server timezone offset)
  • user_utc (Convert a date to UTC based on the user timezone offset)
  • url (URL filter which also ensure the protocol is present)
  • tel (Filter for phone number. It will try and match against specific patterns, else return a string of numbers)

For a full list of jInput filters and how to use them, see Retrieving request data using JInput.

Hope this helps

6
  • Where did you get/find this? Am looking at joomla\libraries\filter\input.php, and see some from your list and others that you haven't included.
    – GDP
    Dec 22, 2014 at 20:57
  • 1
    Have a look here: github.com/joomla/joomla-cms/blob/master/libraries/joomla/form/…
    – Lodder
    Dec 22, 2014 at 20:58
  • @GDP - The filters in the file you mentioned are for JInput as show here
    – Lodder
    Dec 22, 2014 at 21:01
  • 1
    No worries. As for the custom filters, you can most likely create your own by extending the class, but have never tried this.
    – Lodder
    Dec 22, 2014 at 21:05
  • 1
    In joomla 3.9.24 unit tests suite on the official joomla-cms repo you can find some more filter type such as php custom function, php custom method, word, and int here is the link github.com/joomla/joomla-cms/blob/3.9.24/tests/unit/suites/… Apr 2, 2021 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.