Changing Text To Uppercase Etc

Hi All

I was wondering is there a way to convert the text input by the customer to a form that is more suitable?

eg..........

Customer inputs shipping addres as...

111 the made up road

somewhere

in a county

aa112bb

I want it convert (for Shipping note) to.....

111 The Made Up Road

Somwhere

In A County

AA11 2BB

or.....

111THE MADE UP ROAD

SOMEWHERE

IN A COUNTY

AA11 2BB

If that makes sense, because it's a pain when we have to copy and paste shipping note so that wee can alter it.

Thanks in advance

Barry

Hi All

I was wondering is there a way to convert the text input by the customer to a form that is more suitable?

eg..........

Customer inputs shipping addres as...

111 the made up road

somewhere

in a county

aa112bb

I want it convert (for Shipping note) to.....

111 The Made Up Road

Somwhere

In A County

AA11 2BB

or.....

111THE MADE UP ROAD

SOMEWHERE

IN A COUNTY

AA11 2BB

If that makes sense, because it's a pain when we have to copy and paste shipping note so that wee can alter it.

Thanks in advance

Barry

Hello, Barry!

You can use the strtoupper function.

Thank you.

Not sure how to do it but I'll try.

Thanks again

Barry

Thank you.

Not sure how to do it but I'll try.

Thanks again

Barry

You can read more about it here

I think he mean you would use strtoupper for the postal code and ucwords for the other fields where you just want title-case.

You can also do this via CSS using the various text-translate functions.

Hi

Thank you both.

i have done it with....text-transform: none|capitalize|uppercase|lowercase|initial|inherit;

Working fine

thanks again

Barry

Very interesting, was just searching for this but.. have the OPPOSITE problem. It seems the form automatically makes everything an upper case when it is the first character.. but this also happens with email addresses which are always lower case!

I thought to have seen a function where you tell to automatically create capitals, but apparently that also makes capitals out of the first character of an email address?

TIA,

Yvana

It is usually css that controls what case a field is forced to (if any). Most fields in cs-cart do not have any transforms done on the case of the input text. So possibly it was added to your site or an addon has provided css that is reaching beyond the intended scope. The php function to make a string "title case" is ucwords() and to make a string all upper is strtoupper() and to lower is strtolower(). But most likely, you have css that is transforming the input text. Suggest you "inspect" the code with your browser inspector and see what css is associated with that input field. If you see something like: "text-transform: uppercase" (or lowercase or capitialize) then you'll want to dig down and find the source of the css.