So having downloaded orders from the weekend, I came across 12 that had no capitalisation on any fields as customers had entered information and so I had much tidying to do and thought that their must be a "better way"
Look at the advanced user guide which gives the following code to modify the checkout layout to fix this, however the code contains errors:-
<script language=JavaScript>
<!--
function capitalizeWords(string) {
var tmpStr, tmpChar, preString, postString, strlen;
tmpStr = string.toLowerCase();
stringLen = tmpStr.length;
if (stringLen > 0)
{
for (i = 0; i < stringLen; i++)
{
if (i == 0)
{
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,stringLen);
tmpStr = tmpChar + postString;
}
else
{
tmpChar = tmpStr.substring(i,i+1);
if (tmpChar == " " && i < (stringLen-1))
{
tmpChar = tmpStr.substring(i+1,i+2).toUpperCase();
preString = tmpStr.substring(0,i+1);
postString = tmpStr.substring(i+2,stringLen);
tmpStr = preString + tmpChar + postString;
}
}
Advanced Users Guide - 105
}
}
return tmpStr;
}
// -->
</script>
I copied my checkout page and added this code to try it anyways with the accompanying additional coding to the relevant input tag ( onchange="this.value = capitalizeWords(this.value)" ) but this does not work. Searched the community for any other solutions and found a style change but this is visual only so it changes the text as customers type into the website but does not change the invoice page when the customer completes the order and does not change the details I download from the website. Is their any update to this coding that is relevant to V11 that will make it work? Or do any peoples know of a solution, please help.
Richard Kings
www.formyoffice.co.uk
Look at the advanced user guide which gives the following code to modify the checkout layout to fix this, however the code contains errors:-
<script language=JavaScript>
<!--
function capitalizeWords(string) {
var tmpStr, tmpChar, preString, postString, strlen;
tmpStr = string.toLowerCase();
stringLen = tmpStr.length;
if (stringLen > 0)
{
for (i = 0; i < stringLen; i++)
{
if (i == 0)
{
tmpChar = tmpStr.substring(0,1).toUpperCase();
postString = tmpStr.substring(1,stringLen);
tmpStr = tmpChar + postString;
}
else
{
tmpChar = tmpStr.substring(i,i+1);
if (tmpChar == " " && i < (stringLen-1))
{
tmpChar = tmpStr.substring(i+1,i+2).toUpperCase();
preString = tmpStr.substring(0,i+1);
postString = tmpStr.substring(i+2,stringLen);
tmpStr = preString + tmpChar + postString;
}
}
Advanced Users Guide - 105
}
}
return tmpStr;
}
// -->
</script>
I copied my checkout page and added this code to try it anyways with the accompanying additional coding to the relevant input tag ( onchange="this.value = capitalizeWords(this.value)" ) but this does not work. Searched the community for any other solutions and found a style change but this is visual only so it changes the text as customers type into the website but does not change the invoice page when the customer completes the order and does not change the details I download from the website. Is their any update to this coding that is relevant to V11 that will make it work? Or do any peoples know of a solution, please help.
Richard Kings
www.formyoffice.co.uk
Comment