• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Validation Plugins

  • Views Views: 27,485
  • Last updated Last updated:

Navigation

      Access element (+)
      Birthday element
      Button element
      Calculation element
      Captcha element
      Checkbox element
      Colour Picker element
      Count element (+)
      Database join element
      Date element
      Digg element
      Display text element
      Dropdown element
      Facebook Like element
      Field element
      File Upload element
      Folder element
      Google Map element
      Image element
         Image databese join
      Internal id element
      IP element
      J!Date element
      Kaltura element
      Link element
      Notes element
      OpenStreetMap element
      Picklist element
      Radio Button element
      Rating element
      Sequence element
      Slider element
      Tags element
      Textarea element
      Thumbs element
      Time element
      Timer element
      Timestamp element
      Total element
      User element
      User group element
      Video element
      View level element
      YesNo element
      Youtube element
      Akismet validation
      Is Email validation
      Is Not validation
      Is Numeric validation
      Not empty validation
      PHP validation
      Rsa id
  • Every element can be validated during input to ensure that the data being entered meets defined criteria e.g. required or integer or in a particular format (e.g. phone numbers).

    Validation is performed using Validation Plugins, each of which is described separately.

    Validation conditions​


    Most Validation plugin's have a condition field. This expects to receive a PHP statement which returns true or false.
    If it returns true then the Validation is run
    If it returns false then the Validation is ignored.

    Sometime it is desirable that the Validation is only run, when the element on which it resides, is editable by the current user. This prevents a lock, when the element would not validate and the user can not edit this element. It could be done by the following condition:
    PHP:

    return $this->elementModel->canUse();
    which returns true if the current user can edit the element.

    Validations can use Placeholders, so a valid condition statement is:

    PHP:

    return '{table___element}' === '1';

    For multiple conditions you can use the following format

    PHP:

    or condition
    return '{table___element}' == 2 || '{table___element}' == 1;
    and condition
    return '{table___element}' == 2 && '{table___element}' == 1;

    To only run a condition if the user has new/edit access for that element:

    PHP:

    return $this->elementModel->canUse();

    Since 21 Sept 2015, when the element which is being validated is in a repeat group, '{table___element}' will refer to the repeat group's data.

    Preventing validation based on a condition​

    Example:
    Element A has three Options "Foo", "Bar", "Dog"
    Element B is conditionally hidden and has a Validation of "notempty"
    If "Foo" or "Bar" is selected then Element B shows up.
    If "Dog" is selected Element B is hidden but still requires Validation!
    To prevent the Validation of radio element B if value of radio element A is "Dog" - put the following code into the condition textarea of element B.
    PHP:

    if ('{table___element_a}' == "Dog")
    {
    return false;
    }
    else
    {
    return true;
    }

    Translating Validation Error Messages​


    Validation error messages are parsed through Joomla's JText function meaning you can provide Translations for you error messages.


    • First edit an element and create a validation rule e.g. a not empty rule
    • Enter 'COM_FABRIK_CUSTOM_NOT_EMPTY' as the 'Error message'
    • Save the element
    • Go to Extensions -> language manager -> overrides
    • From the language drop down on the right hand side, select the language for which you want to provide a translation (e.g. select 'Englsh (United Kingdon - SIte)')
    • Press the 'new' button
    • Enter 'COM_FABRIK_CUSTOM_NOT_EMPTY' as the 'Language constant. This should match your validation's error message
    • Provide a translation in the 'Text' textarea, e.g 'Please enter something'
    • Save the entry

    Validation icons​

    Validation icons can be defined in the plugin settings "Options" (Extensions/Plugins)
    Insert your icon name, e.g. star or envelope
Back
Top