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