I have a JS where I can detect if uppercase is being entered, but I’m unable to convert the text text to lower case. i have used CSS text-transform: lowercase;
but this shows that it’s lower but once submitted, it shows the text as normal (original format).
I have tried with jquery toLowerCase();
but I don’t know what I have missed here coz it didn’t work.
this is my script,
const setup = function(fieldSelector) {
const field = $(fieldSelector);
const upperCase= new RegExp('[A-Z]');
const applyStyle = function() {
if (field.val().match(upperCase)) {
field.val().toLowerCase();
} else {
field.val();
}
};
field.on('change', applyStyle);
applyStyle();
}
// Note: Change the ID according to the custom field you want to target.
setup('#issue_custom_field_values_17');
});
this code is used for redmine "View customize plugin"
4
Answers
Uppercase doesn’t change the original string. Try assigning a new variable for your uppercase and see if it works!
I think this should do the job for you
try this
You can set the value of the field to the new lowercase value on change