Crow Canyon Software Forum
How to convert entry field to Proper Case
Quote from skigeek on June 6, 2023, 9:59 amI have uploaded a javascript file for my sharepoint site and then pointed the custom javasript link to it under the "Custom JavaScript" the file looks like this. I have used this code before to conver a string to ProperCase.
function toTitleCase(str) {
return str.replace(
/\w\S*/g,
function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
}On the "On Column Value Change Event" for that column I have an Execute Script with the following
var city = _ccs_FormUI.fetchColumnValueUI("City"));
return toTitleCase(city);Does not seem to work. Am I putting this in the wrong place? Any Suggestions would be greatly appreciated.
I have uploaded a javascript file for my sharepoint site and then pointed the custom javasript link to it under the "Custom JavaScript" the file looks like this. I have used this code before to conver a string to ProperCase.
function toTitleCase(str) {
return str.replace(
/\w\S*/g,
function (txt) {
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
}
);
}
On the "On Column Value Change Event" for that column I have an Execute Script with the following
var city = _ccs_FormUI.fetchColumnValueUI("City"));
return toTitleCase(city);
Does not seem to work. Am I putting this in the wrong place? Any Suggestions would be greatly appreciated.
Quote from supportTeam on June 12, 2023, 10:52 am
- Hi @skigeek,
- Please find steps to convert a column value to title case:
- Please update the JavaScript code by referring attached file. <Please refer CCS_TitleCaseJS.pdf>
- Configure an empty variable. This will be used in Form Event Actions in next steps. <Please refer TitleCase_1.png>
- Please find detailed steps to configure Form Event Actions for updating a column to title case.
Note: In this example, we have configured FEA to update ‘Title’ column to title case. When ‘Title’ column value changes, it is required to convert the column value to title case.
- Configure a FEA on column value change event: <Please refer TitleCase_2.png>
- Add ‘Set Variables Value’ action. <Please refer TitleCase_3.png>
- Map the ‘TitleCase’ variable configured in #2. above. <Please refer TitleCase_4.png>
Note: Please find the attached script. <Please refer CCS_VariableMapping.pdf>- Add ‘Update form controls’ action.
Condition: Advanced Condition ‘not equal’ TitleCase##Value,, <Please refer TitleCase_5.png>- Column value mapping for ‘Title’ column. <Please refer TitleCase_6.png>
Syntax: VariableName##Value
Example: TitleCase##Value
- Hi @skigeek,
- Please find steps to convert a column value to title case:
- Please update the JavaScript code by referring attached file. <Please refer CCS_TitleCaseJS.pdf>
- Configure an empty variable. This will be used in Form Event Actions in next steps. <Please refer TitleCase_1.png>
- Please find detailed steps to configure Form Event Actions for updating a column to title case.
Note: In this example, we have configured FEA to update ‘Title’ column to title case. When ‘Title’ column value changes, it is required to convert the column value to title case.
-
- Configure a FEA on column value change event: <Please refer TitleCase_2.png>
- Add ‘Set Variables Value’ action. <Please refer TitleCase_3.png>
- Map the ‘TitleCase’ variable configured in #2. above. <Please refer TitleCase_4.png>
Note: Please find the attached script. <Please refer CCS_VariableMapping.pdf> - Add ‘Update form controls’ action.
Condition: Advanced Condition ‘not equal’ TitleCase##Value,, <Please refer TitleCase_5.png> - Column value mapping for ‘Title’ column. <Please refer TitleCase_6.png>
Syntax: VariableName##Value
Example: TitleCase##Value
Quote from supportTeam on June 12, 2023, 12:17 pmAttached files.
Attached files.
Uploaded files: