Skip to content

Instantly share code, notes, and snippets.

@bootleg224
Created June 1, 2022 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bootleg224/667d82659cc621a1f6c1d63b51447b01 to your computer and use it in GitHub Desktop.
Save bootleg224/667d82659cc621a1f6c1d63b51447b01 to your computer and use it in GitHub Desktop.
//Step 1: Copy/Paste this into Console
FrontendApiManager.onReady("submissionForm", function (api) {
window.api = api;
});
//Step 2: Copy and Paste this Function and the handler
//Define Title Case Method
function titleCase(str) {
str = str.toLowerCase().split(' ');
for (var i = 0; i < str.length; i++) {
str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);
}
return str.join(' ');
}
//Call Javascript API
var titleField = api.getField("title");
titleField.onChange(function (oldVal, newVal) { titleField.setValue(titleCase(newVal)); });
//Step 3: Now type something in to the title field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment