Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

No UpperCase?

Go to End

8 Posts   5382 Views


Community Member, 35 Posts

27 March 2009 at 6:22am

Creating a custom page type, and working on the custom template portion.

Have a need to convert the contents of a TextField to upper case.

Notice that $FieldName.LowerCase works just fine - but apparently $FieldName.UpperCase was left out?

Any ideas on how I can accomplish this?


Ben Gribaudo

Community Member, 181 Posts

27 March 2009 at 9:12am

If you don't mind doing this in CSS, you can use the text-transform directive.

This may not be what you're looking for....


Community Member, 35 Posts

28 March 2009 at 1:47am

Appreciate the response Ben - but not quite what I was looking for.

Pretty astounded that they took the time to put in a LowerCase method, but decided to not take the extra step and supply a corresponding UpperCase method.

* scratches head *


Community Member, 35 Posts

28 March 2009 at 2:45am

Edited: 28/03/2009 2:45am

Well, regardless of why it wasn't added in - I decided to take some initiative and add the following code snippet to the file:

function UpperCase() {
return Convert::raw2xml(strtoupper($this->value));

I put this right underneath the LowerCase function.

Solved the problem...


Community Member, 10 Posts

31 March 2009 at 11:13am

Has anyone figured out to add this kind of functionality to the DBField class and subclasses without hacking the core? I tried Object::useCustomClass() but apparently you can only use that for certain core classes. I've been wanting to add a toCamelCase and toSnakeCase method to Varchar and similar classes, but I haven't found out how to do it without hacking core files.


Community Member, 35 Posts

1 April 2009 at 4:53am

webbower - as I felt it bad form to update the core in order to add this functionality, I asked on the General Questions forum on the best way to get this functionality into the core for a future release.

As the method I'm proposing is ridiculously simple (just a copy of the toLowerCase except for UpperCase), I figure I'll just submit a simple patch request.

Hope that helps...


Forum Moderator, 5523 Posts

1 April 2009 at 5:10pm

ImacSS - functions in the core esp round strings, date etc are just added when we need them in a project. I doubt there is a 'design' decision behind not including it so I'm sure if you submit a patch it will be included in the next release :)

As for your post "How to make a recommendation?" I didnt see it in that forum but anyway as a note you should usually make a ticket on with the patch / changes you wish. If its a large change or an API change then post it to the ss-dev mailing list as this will generate some discussion


Community Member, 35 Posts

2 April 2009 at 2:57am

willr - thank you very much for the info. I have posted a patch request using the info you provided.

thanks again...