How to force UPPERCASE letters?
How to force UPPERCASE letters?
Hi! I have searched the entier forum for this issue, but haven't found anything letaded... So the question is:
While someone is typing and inserting data through the form fields, how can i force the conversion to UPPERCASE letters?
Any assistance will be appreciated
While someone is typing and inserting data through the form fields, how can i force the conversion to UPPERCASE letters?
Any assistance will be appreciated
Re: How to force UPPERCASE letters?
Hi,
you can change the data in the hooks. Use the before_insert and before_update functions and use something like:
$data['YOURFIELDNAME']=strtoupper($data['YOURFIELDNAME']);
you can change the data in the hooks. Use the before_insert and before_update functions and use something like:
$data['YOURFIELDNAME']=strtoupper($data['YOURFIELDNAME']);
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: How to force UPPERCASE letters?
another option on tablename_dv.js use javascript on change function .toUpperCase();
https://www.w3schools.com/jsref/jsref_touppercase.asp
https://www.w3schools.com/jsref/jsref_touppercase.asp
Re: How to force UPPERCASE letters?
As mentioned by D Oliveira, I use javascript in my TABLENAME-dv.js file in the hooks directory.
Create a new file and change the TABLENAME to yours.
Put the following code and don't forget to change the FIELDNAME to match with yours.
Good luck.
Create a new file and change the TABLENAME to yours.
Put the following code and don't forget to change the FIELDNAME to match with yours.
Code: Select all
// Set input to automatically convert to Uppercase. File hooks/tablename-dv.js
$j('#FIELDNAME').keyup(function () {
$j(this).val($j(this).val().toUpperCase());
});
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: How to force UPPERCASE letters?
Thanks a lot guys for your replies.
So i use the code below, in my tablename-dv.js file, as mentioned by zibrahim
but it doesn't seem to work. am i missing something?
Regards
Spiros
So i use the code below, in my tablename-dv.js file, as mentioned by zibrahim
Code: Select all
// Set input to automatically convert to Uppercase.
$j('my_field_name').keyup(function () {
$j(this).val($j(this).val().toUpperCase());
});
Regards
Spiros
Re: How to force UPPERCASE letters?
Hi Spiros
Can I know the tablename and the fieldname that you are using for this issue?
Can I know the tablename and the fieldname that you are using for this issue?
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: How to force UPPERCASE letters?
By the way,
I noticed that there is no # character before your FIELDNAME in your code. Perhaps that is the reason?
It should be
I noticed that there is no # character before your FIELDNAME in your code. Perhaps that is the reason?
It should be
Code: Select all
$j('#my_field_name').keyup(function () {
$j(this).val($j(this).val().toUpperCase());
});
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: How to force UPPERCASE letters?
Hi Zibrahim,
Yes i was missing the # character as i thought it was an example character. I incuded the # character before the fieldname and again it did not to work....
BUT, the clue for me was to insert the code on the top of TABLENAME-dv.js !!! As long as i had the code at the end of this file, the code did not respond. Now it does
Thanks a lot for your help mate!
- aarlauskas
- Veteran Member
- Posts: 127
- Joined: 2019-04-28 18:03
- Location: Medway, UK
Re: How to force UPPERCASE letters?
Thanks Ibrahim, very simple solution and very handy! Thank You!
Re: How to force UPPERCASE letters?
Hi zibrahim,zibrahim wrote: ↑2020-08-13 02:52As mentioned by D Oliveira, I use javascript in my TABLENAME-dv.js file in the hooks directory.
Create a new file and change the TABLENAME to yours.
Put the following code and don't forget to change the FIELDNAME to match with yours.Good luck.Code: Select all
// Set input to automatically convert to Uppercase. File hooks/tablename-dv.js $j('#FIELDNAME').keyup(function () { $j(this).val($j(this).val().toUpperCase()); });
When i use that code it's working. However if i edit a record (for example the field is "name") and it has "Onder", i want to change the "n" and "d" characters, when i write "r" instead of "d" the cursor is going to end of the field. Is there a way to blocking it?
Best regards.
Re: How to force UPPERCASE letters?
Hi there Yonder,
try this
I found this in the internet
https://stackoverflow.com/questions/542 ... f-the-text
Have a nice day.
try this
Code: Select all
// Set input to automatically convert to Uppercase while maintaining cursor position
$j('#FIELDNAME').keyup(function () {
const startPos = (this).selectionStart;
const endPos = (this).selectionEnd;
(this).value = (this).value.toUpperCase();
(this).setSelectionRange(startPos, endPos);
});
https://stackoverflow.com/questions/542 ... f-the-text
Have a nice day.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: How to force UPPERCASE letters?
zibrahim wrote: ↑2023-10-02 10:49Hi there Yonder,
try thisI found this in the internetCode: Select all
// Set input to automatically convert to Uppercase while maintaining cursor position $j('#FIELDNAME').keyup(function () { const startPos = (this).selectionStart; const endPos = (this).selectionEnd; (this).value = (this).value.toUpperCase(); (this).setSelectionRange(startPos, endPos); });
https://stackoverflow.com/questions/542 ... f-the-text
Have a nice day.
zibrahim wrote: ↑2020-08-13 02:52As mentioned by D Oliveira, I use javascript in my TABLENAME-dv.js file in the hooks directory.
Create a new file and change the TABLENAME to yours.
Put the following code and don't forget to change the FIELDNAME to match with yours.Good luck.Code: Select all
// Set input to automatically convert to Uppercase. File hooks/tablename-dv.js $j('#FIELDNAME').keyup(function () { $j(this).val($j(this).val().toUpperCase()); });
Hi zibrahim,
Yes it's working thanks. However i want to use the Turkish characters. If i use "ğüşöç" characters it can change to "ĞÜŞÖÇ" characters, but if i use "i" character it change it to "I" not "İ".
I was use the following code before your answer;
Code: Select all
$j('#pozisyon').keyup(function () {
$j(this).val($j(this).val().toLocaleUpperCase('tr-TR'));
Thank you so much.
Re: How to force UPPERCASE letters?
Hello again,
Sorry, i just found the solution
Now it's working. Thank you so much again zibrahim.
Sorry, i just found the solution
Code: Select all
$j('#FIELDNAME').keyup(function () {
const startPos = (this).selectionStart;
const endPos = (this).selectionEnd;
(this).value = (this).value.toLocaleUpperCase('tr-TR');
(this).setSelectionRange(startPos, endPos);
});