1. "Fabrik 4" helpers needed!

    You are invited to join other community members active in coding, maintaining and improving Fabrik. Please visit https://fabrik.help for more information!
    Dismiss Notice

Field element

Aug 15, 2018
Field element
  • field-options.png
    • Hidden - sets the date to be rendered as a hidden field
    • Default - The default value to populate the element with. If the eval option is selected then this should contain a PHP expression
    • Eval - If set to yes then the value entered in the default field is taken to be a PHP expression and is evaluated as such. Element default examples.
    • Placeholder - Text to show inside the field, when the user has not yet entered a value
    • Input type - Defines which HTML input type to use.
    • Max length - The maximum number of characters the user is allowed to type into the field.
    • Disable element - Disable the element, the user is not allowed to changed the value and the value is NOT stored in the database.
    • Read only - The user is not able to change the field's value but the value IS stored in the database.
    • Auto complete - If set to yes (default behavior) then the browser will show any previously entered values for any field which had the same name. Note this is NOT an ajax auto-complete look-up to the database. For that use the database join element rendered as auto complete.
    • Speech recognition - Currently for Chrome 11 + only. Enables text entry via your microphone.
    • Bootstrap class - Adds a class to the input, which defines the input's width.
    • Format - Define what type of data the field should store in the database
    • Integer length - The length of the integer field when the format is set to integer or decimal
    • Decimal length - The decimal length stored in the database when the format is set to decimal
    • Number format - If yes, value will be processed through PHP's number_format() function, which will insert thousand separators, and use the decimal point you specify below. So (for instance) to format French numbers, you would use a Thousand Separator of '#32' and a Decimal Point of '.'.
      This option will also use the Decimal Length option, rounding the number if necessary.

      Formatting is only applied when rendering the number in a list or detail view, does not affect how the value is stored in the table.
      Note: number_format() will be applied BEFORE any sprintf() format you may specify in the 'Format string' option, which may mean that sprintf may not recognize the value as a number.
    • Thousand Separator - If you selected Yes for Number Format, this will be used as the thousand separator. If you need to specify a space (i.e,. for French number formatting), put #32 instead (Joomla strips spaces from parameters when saving, so you can't just put a space here!).
    • Decimal Point - If you selected Yes for Number Format, this will be used as the decimal point character.
    • Format string - Applies the PHP sprintf function to the string when displaying the data in the list view or detailed view.
    • Input Mask - An input mask string. This uses the input mask jQuery plugin http://digitalbush.com/projects/masked-input-plugin/. It allows a user to more easily enter fixed width input where you would like them to enter the data in a certain format (dates,phone numbers, etc).
      This string will input mask : '9' represents a number, 'a' represents alphabetic character (A-Z,a-z), * is either. Characters after '?' are optional. Other characters are inserted in the result.
      Examples :
      - a US telephone number with 3 digit extensions : (999) 999 9999 x999
      - same number with optional digits would be : (999) 999 9999 x999? x99999
      - a serial number would be : aa/999-99-9999
      - a date : 99/99/9999
    • Display as QR Code - Display value as a QR Code in read only views (list, details, or form where element ACL is read only)
    • Guess link type - Will try to guess if the data entered is a URL or email address, if so then in the list view and detailed view the data is wrapped within the corresponding link
    • Link target - sets whether the created link will open in a new window.
    Creating/Generating a Random String, example a password generator (This has been created from a forum post)
    Follow the steps below:
    • Create a new element using the field plugin
    • Add the following code into the default field area

    $length = 10;
      $key = "";
      // define possible characters
      $possible = "0123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRTVWXYZ";
      $i = 0;
      while ($i < $length) {
        $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
          $key .= $char;
    return $key;
    • Below this area, make sure you turn the EVAL Option ON.
    • Save and refresh your form, you will have a random number generated on the form page.
  • Loading...