Results 1 to 4 of 4

Thread: Validating catalog fields

  1. #1
    User
    Join Date
    01-29-13.
    Posts
    64

    Default Validating catalog fields

    Hi to everybody,
    I need to validate the content of a catalog field. I want - for instance - the input to be something like ABCD-ABC-ABC and possibly stop editing if the input is wrong.
    Is it possible to achieve this? I saw that in the catalog module there's a "Enable additional format function" functionality but it appears to me as something devoted to output and not to input validation, right?

    Thank you in advance
    --
    Marco
    ---------
    Triste e' l'uomo
    che ama le cose
    solo quando si allontanano.
    (Baolian, libro dei pensieri Baol, I, vv. 1240-1242)

  2. #2
    User MacKP's Avatar
    Join Date
    06-19-09.
    Location
    Duisburg (Germany)
    Posts
    211

    Default Re: Validating catalog fields

    You can use the dca for something like that:

    Code:
    $GLOBALS['TL_DCA']['tablename']['fields']['rowname']['eval']['readonly'] = true;
    here is an example (is it an email?):

    Code:
    $GLOBALS['TL_DCA']['tabellenname']['fields']['spaltenname']['eval']['rgxp'] = 'email';
    regards
    Mediendepot Ruhr
    For real-time chat the (inofficial) Chatroom in IRC:
    -> irc.freenode.net #contao | irc.freenode.net #contao.de

  3. #3
    User
    Join Date
    01-29-13.
    Posts
    64

    Default Re: Validating catalog fields

    Uhm, this sounds interesting indeed!
    Where should I publish this code? In the extension files? Where exactly? Can I create my own regular expressions as well?

    Thank you
    --
    Marco
    ---------
    Triste e' l'uomo
    che ama le cose
    solo quando si allontanano.
    (Baolian, libro dei pensieri Baol, I, vv. 1240-1242)

  4. #4
    User MacKP's Avatar
    Join Date
    06-19-09.
    Location
    Duisburg (Germany)
    Posts
    211

    Default Re: Validating catalog fields

    This is code for the dcaconfig.php in system/config/
    Maybe you can make your own.. but contao has some by its own. Search for it, maybe the original will do what you need.

    regards
    Mediendepot Ruhr
    For real-time chat the (inofficial) Chatroom in IRC:
    -> irc.freenode.net #contao | irc.freenode.net #contao.de

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •