strtolower

strtolower

nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
edited November 2012 in Editor
Hi,
For any email address entered, I would like to apply the strtolower() function before saving it to my db.
In Editor (PHP side) how would I implement this?
Merci,
Nathan

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Hi Nathan,

    You'd use a set formatter: http://editor.datatables.net/docs/current/php/class-DataTables.Editor.Field.html#_setFormatter . There are a few set formatters built in ( http://editor.datatables.net/docs/current/php/class-DataTables.Editor.Format.html ) but not one for strtolower - a little closure function would do the business there.

    [code]
    ->setFormatter( function($_, $opts=null ) {
    return strtolower( $_ );
    }
    [/code]

    Allan
  • nskwortsownskwortsow Posts: 120Questions: 0Answers: 0
    Perfect; works like a charm.
This discussion has been closed.