Forums

Uppercase value in field not save in database

chekwan 16 Mar, 2019
Hi,

I want to make some of my text field in uppercase mode. I'm using this method to force uppercase text:
https://www.chronoengine.com/forums/posts/t104307/uppercase-in-form-fields/

unfortunately, when I view the submit record, the uppercase text not save in database. It still in lowercase mode.

how can I do to make this uppercase text also save in database.


please help..
healyhatman 17 Mar, 2019
Answer
1 Likes
Using CSS just makes it LOOK uppercase on the frontend.

You'll want to use PHP in the submit event.
$this->data("fieldname", strtoupper($this->data("fieldname", "")), true);

Or you could TRY in your override on insert section of your save data action
dbfieldname:UPPER({data:formfieldname})
But I don't think that will work.
chekwan 17 Mar, 2019
Hi Healyhatman,

Based on your advice, I have try to put the PHP code action like this before the Save Data action:

I replace the "fieldname" with my field name accordingly. But its not working.

$this->data("myfield01", "myfield02", "myfield03" strtoupper($this->data("myfield01", "myfield02", "myfield03")), true);


UPDATE:
----------------------------------------------
I have failed do the uppercase because I have put the wrong code. After that I tried to change the code format and I successfully do the uppercase text. 🤣🤣
$this->data("myfield01", strtoupper($this->data("myfield01", "")), true);
$this->data("myfield02", strtoupper($this->data("myfield02", "")), true);
$this->data("myfield03", strtoupper($this->data("myfield03", "")), true);


thanks buddy! cheers!
This topic is locked and no more replies can be posted.