Uppercase value in field not save in database

How to save uppercase text from a form field to the database in ChronoForms.

Overview

The issue occurs because using CSS to display uppercase text only affects the frontend appearance and does not modify the data before it is saved.
To resolve this, add a PHP code action in the form's submit event before the Save Data action. Use the appropriate PHP function for each specific field to convert the submitted text to uppercase, ensuring the modified data is stored in the database.

Answered
ChronoForms v6
ch 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..
he 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.
ch 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.