Created
June 1, 2022 20:15
-
-
Save bootleg224/667d82659cc621a1f6c1d63b51447b01 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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