Check on length string results in translation of tags

Check on length string results in translation of tags

nessinitsnessinits Posts: 86Questions: 27Answers: 0
edited January 2018 in Bug reports

Hi,

When I use:

                Field::inst( 'am_templateblocks.content' )
                    ->validator( Validate::maxLen( 4000, ValidateOptions::inst()
                    ->message( 'Dit veld mag maximaal 4000 karakters zijn' ) ) ),

The input of "<section>" results in the unexpected "&lt;section&gt;"

Why is this? Is this a bug, or can it be configered to accept tags?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin

    Same bug in the documentation as your other thread I'm sorry to say. Use:

    Field::inst( 'am_templateblocks.content' )
        ->validator( Validate::maxLen( 4000, '.', ValidateOptions::inst()
        ->message( 'Dit veld mag maximaal 4000 karakters zijn' ) ) ),
    

    Allan

  • nessinitsnessinits Posts: 86Questions: 27Answers: 0

    Are you sure? This results in:

    Fatal error:  Call to a member function optional() on a non-object in /mydomainpath/datatables/php/lib/Editor/Validate.php on line 176
    
    

    You're probably right, but I am probably missing something.

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    No - I'm completely wrong. I misread maxLen as maxNum - sorry! Your original code was fine, but what threw me was the forum decoding the entities. I've added code marking to your post above so the issue is shown now.

    That is being caused by Editor's built in XSS protection - full details of which are here. The manual also shows how you can disable that, so you don't run into that problem.

    Allan

This discussion has been closed.