(editor) force string to lowercase before writing to database
(editor) force string to lowercase before writing to database
Can anyone help me out ?
How would be the right syntax for formatting an string to lowercase before writing to database
i have this (shortened)
$db->sql('set names utf8');
$editor = Editor::inst(
$db, 'alle_post',
'alle_post.post_idn' /* Primary Key /
)
->fields(
Field::inst('alle_post.webx_idn'),
Field::inst('alle_post.post_nam'), / this should be lowercase */
);
$editor
->debug(true)
->process($_POST)
->json();
This discussion has been closed.
Replies
Providing a custom formatter would be the logical approach.
https://editor.datatables.net/manual/php/formatters
thank tangerine, but could you give me an example please. i don't get it.
This example from this thread shows how to do it on the client (this is to upper case, but you'll get the idea).
This section of the manual shows how to create a formatter that tangerine mentioned on the server,
Colin
thx colin, following your js bin example
but get an error:
Uncaught TypeError: Cannot read property 'toUpperCase' of undefine
That would suggest
post_nam
isn't part of the data. Can you addconsole.log(o)
at the start of theif
clause, please, and report back,Colin
Probably easier to use a PHP for matter here:
Allan
great guys! alan's Solution did it within the lightbox-editing. how can i achieve this also within inline-editing ?
The server side PHP code is identical for form editing and inline editing.
thx, now it works. this was missing:
editField: 'alle_post.post_nam',