Skip to main content
Known Participant
October 22, 2024
Answered

Automatically change case to titlecase

  • October 22, 2024
  • 1 reply
  • 697 views

Hello!

 

Is there a way to set a text field to automatically convert text to titlecase?

 

The scenario includes copying all caps text from another document. When that all caps text pastes into the text field, is there functionality available to automatically convert it to titlecase?

 

Thank you so much for your help!

This topic has been closed for replies.
Correct answer PDF Automation Station

Enter the following as a custom calculation script in the field:

function toTitleCase(str) {
  return str.toLowerCase().split(' ').map(function (word) {
    return (word.charAt(0).toUpperCase() + word.slice(1));
  }).join(' ');
}
event.value=toTitleCase(event.value)

1 reply

PDF Automation Station
Community Expert
Community Expert
October 22, 2024

Enter the following as a custom calculation script in the field:

function toTitleCase(str) {
  return str.toLowerCase().split(' ').map(function (word) {
    return (word.charAt(0).toUpperCase() + word.slice(1));
  }).join(' ');
}
event.value=toTitleCase(event.value)
Known Participant
October 23, 2024

Thank you so much! This worked beautifully. Many thanks to you.