Copy link to clipboard
Copied
Hello,
I'm hoping someone could help me with a script or even a regular to remove the blank spaces between words in the text entry boxes. I found this thread from 3 years ago, but the code doesn't seem to work - I'm using Captivate 9:
Removing spaces from text from text entry box
At the time the solution posted was:
var objCP = document.Captivate;
var jsTextEntry = objCP.cpEIGetValue('TextEntryBox1');
var jsNoSpaces = jsTextEntry.replace(/ /g,'');
objCP.cpEISetValue('varNoSpaces', jsNoSpaces);
But again, this doesn't work for me. Any suggestions? Thanks.
Bill
Never mind, I think I figured it out. For future reference, this seemed to work - changes the multi-word cpQuizInfoStudentName to OneWordName without spaces:
var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );
var newName = getName.replace(/ /g,'');
window.cpAPIInterface.setVariableValue('v_OneWordName', newName);
Copy link to clipboard
Copied
Never mind, I think I figured it out. For future reference, this seemed to work - changes the multi-word cpQuizInfoStudentName to OneWordName without spaces:
var getName = window.cpAPIInterface.getVariableValue( "cpQuizInfoStudentName" );
var newName = getName.replace(/ /g,'');
window.cpAPIInterface.setVariableValue('v_OneWordName', newName);