Results 1 to 7 of 7

Thread: accentuated caracters checking

  1. #1
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default accentuated caracters checking

    Hello,
    About checking the form text fields,
    I don't succeed in finding a solution to validate the input only for alphabetics and accentuated caracters (it is a french site).
    Have I to modify the formcheck source code.

    Thanks for help
    Sharing and growing

  2. #2
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: accentuated caracters checking

    Actually you need to give some more information...

    Can you show what you have tried, and exactly what part you are working on?

  3. #3
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Re: accentuated caracters checking

    Thank you Vera for replying,
    In a form text field, I indicated an alphanumumeric checking, but the accentuated caracters are not allowed.
    I tried the extended alphanumumeric checking, and that's work :
    the accentuated caracters are allowed, but also also the special caracters (#/()), and it 's not very fine.

    Is there another mean to specify only, accentuated and not accentuated, alpabetic caracters ?
    Sharing and growing

  4. #4
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: accentuated caracters checking

    You may need to put in a ticket at http://dev.contao.org to point this out to Leo, requesting he extend the rgxp check for alpha and alnum characters.
    Its hard unless you read German, but try to search for similar tickets first before you do.
    As far as i know extnd is your best bet - unless you write your own regular expression and use a addCustomRegexp hook.

    http://www.contao.org/hooks.html

  5. #5
    User
    Join Date
    01-25-10.
    Location
    France
    Posts
    61

    Default Re: accentuated caracters checking

    Thanks Ramjet for this answer,

    I see how tu use the addCustomRegexp hook ( http://www.contao.org/hooks.html)
    It seems to me very interesting tu use it

    But I dont' see how and where to define the name of the regexp (in the exemple : 'postal' )
    is it in the back end ? or by writting some code ?
    Sharing and growing

  6. #6
    User
    Join Date
    06-29-09.
    Posts
    271

    Default Re: accentuated caracters checking

    Doesn't "extended alphanumeric characters" work for you? :?

    Otherwise you can add your own regular expression to the dca of tl_form_field as declared in
    TL_ROOT\system\modules\backend\dca\tl_form_field.p hp
    Code:
    		'rgxp' => array
    		(
    			'label'                   => &$GLOBALS['TL_LANG']['tl_form_field']['rgxp'],
    			'exclude'                 => true,
    			'inputType'               => 'select',
    			'options'                 => array('digit', 'alpha', 'alnum', 'extnd', 'date', 'time', 'datim', 'phone', 'email', 'url'),
    			'reference'               => &$GLOBALS['TL_LANG']['tl_form_field'],
    			'eval'                    => array('helpwizard'=>true, 'includeBlankOption'=>true, 'tl_class'=>'w50')
    		),
    You can extend the options by adding your own extension that adds both the hook and the new rgxp option. You must name the extension as something that comes after "frontend" alphabetically. The dca is an array, so you just add in your option, do not forget the translation. You can then use your own rgxp via the hook :D 8-)

    Additional information:
    1. The new extension has to have a file TL_ROOT\system\modules\yourextension\dca\tl_form_f ield.php. This file you use to change the dca and add your option.[/*:m:30jw4m06]
    2. The hook goes into a class you can name yourself, but that file goes into the root of your extension and has the same name as the class + .php. You can follow the instructions on the hooks page to complete this.[/*:m:30jw4m06]
    3. Some hints on how to do the regular expressions are in the function that implements the hook. Search the Contao code for the name of the hook and you'll better understand how it functions. :P [/*:m:30jw4m06]

  7. #7
    User taca's Avatar
    Join Date
    06-20-09.
    Location
    Kyoto, Japan
    Posts
    111

    Default Re: accentuated caracters checking

    My simple extension could be help for adding your own hook: NoIDNvalidator
    --
    Takahiro Kambe

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
  •