• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Title Case on field element

mediaateam

Administrator
I need to force the text in a field to be Title Case. I saw an old forum posting about using js inline on change for all upper case, so I tried the same for this, but it didn't work.

Here's what I have on the Javascript on the field element:

The js is set to work "on change"
Code:
this.value=this.value.toTitleCase();

It doesn't seem to be working. Anyone have a better solution?
 
Good guess but no, there is no native toTtitleCase in Javascript. And it's actually not as simple as you might think, depending how persnickety you want to get. Like, do you need to support names like O'Brian, or McDonald, or Billy-Bob. Do you want to leave "short words" (and, in, of, the, to, etc) un-cased?

Here's one of the best Stack Overflow discussions and a variety of solutions:

http://stackoverflow.com/questions/196972/convert-string-to-title-case-with-javascript/196991#196991

So decide which approach you need to go with, and I'll help you get it going.

-- hugh
 
Is it for display or storing in DB?
It's also possible to use CSS (text-transform: capitalize; ) or php (ucwords (), e.g. in a php validation with replace)
 
I'm assuming she'll want it stored that way, and will want to handle some of those special cases like hyphens and quotes.

Sent from my HTC6500LVW using Tapatalk
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top