Showing results for 
Show  only  | Search instead for 
Did you mean: 

Escalate Topic

Changemaker II

I thought there might be a way to achieve this using regex and replaceAll , but couldn't get that to work.

I have found a way to do it which works.  

Pop an HTML Element into your form and paste in the following code  and then edit line 2 and 3 so that fromElementID is the dataname of your field that is all uppercase and toElementID is the dataname of the field that should contain your proper case.  
If your source field is editable then you might want to uncomment the commented out line that adds an event listener to the source field so the function will run whenever it's changed.

as this is a custom javascript solution note that it will not be supported by Granicus 



<script type="text/javascript">
var fromElementID="upprstring";
var toElementID="properstring";

function titleCase(str) {
return str.toLowerCase().split(' ').map(function(word) {
return word.replace(word[0], word[0].toUpperCase());
}).join(' ');
function toTitleCase() {

var upEl = document.querySelector("input[ Name='"+fromElementID+"' ]");
var titEl = document.querySelector("input[ Name='"+toElementID+"' ]");
var orig = upEl.value;

//document.getElementsByName(fromElementID)[0].addEventListener("change", toTitleCase);