Due to a Custumer requirement, I needed to fill some Text Fileds Uppercase, no matter if Cap Lock is ON or OFF.
I found this solution, in tree steps.
1.- Add a CSS Stile line.
a.go to PHP Settings->HTML->STYLES
b. Click on “Edit Styles”
c. At the end , below the line /BEGIN_USER_STYLES/ add the following line:
.convertuppercase {text-transform:uppercase}2.-On Clients Scripts Section choose Global ->Global Code and Add the following function:function func_convert_uppercase(x) {
x.value = x.value.toUpperCase();
}
Choose the field you want to be Uppercase in your table
a. In custom attributes write 'class=“convertuppercase” onchange=“func_convert_uppercase(this)” autocomplete=“off” ’
NOTE: autocomplete=“off” is just to avoid browser´s autocomplete option, because when you are typing a new value, previous typed values for this field are shown in a list.
If you select one of them, the value is saved as is shown , wheter if it is Upper case or Lower Case. (I don´t know Why)I hope it is usefull for you
Hi
First of all, thanks lUTGARDO for your post.How this is related to the same thing, I want to collaborate with another way that I found to do the same thing in one step only.
This way, also will transform the text independently if you will use or not the autocomplete feature, because will transfor all the text once is sent by the browser…
It resides in adding this line of code to Server Events > Table-Specific > Common > Row_Inserting and Row_Updating$rsnew[“name_of_the_field_to_change”]=mb_strtoupper($rsnew[“name_of_the_field_to_change”]);Hope this will be usefull for others, the same way many times I’ve found solutions from the others.Best regards.
I’m putting this under Client side events for the field that I want to be uppercase:{ // keys = event types, values = handler functions
“change keyup”: function(e) {
// Your code
this.value = this.value.toUpperCase();
}
}
Hi Friends…In order to Uppercase each First Letter of a String i use the following jquery code-Paste this code in Table Specific Add/Edit Page => Client ScriptJust Change with yours :
jQuery(document).ready(function() {
jQuery('#x_<fieldname>').keyup(function()
{
var str = jQuery('#x_<fieldname>').val();
var spart = str.split(" ");
for ( var i = 0; i < spart.length; i++ )
{
var j = spart[i].charAt(0).toUpperCase();
spart[i] = j + spart[i].substr(1);
}
jQuery('#x_<fieldname>').val(spart.join(" "));
});
});
Hallo gardowhere do i apply the costum attribute ? is it in custom attribute div / Hyper Custom Attribute
because a double quote or single quote error appears
To add css class into your field, then you may use Row_Rendered server event, for example (adjust FieldName to your actual field name), for example:$this->FieldName->CellAttrs[“class”] = “convertuppercase”;To add onchange event into your field, then you may put this following code in the same event above, for example:$this->FieldName->EditAttrs[“onchange”] = “func_convert_uppercase(this);”;