Gossamer Forum
Home : Products : DBMan : Customization :

Title Case field

Quote Reply
Title Case field
Is there a way to force a field to display in title case (every word initial caps) regardless of what is entered into the field?

Or better yet I suppose convert a field to title case on validation?


Joeh
Quote Reply
Re: Title Case field In reply to
I don't think that will be too hard. Use the inbuilt perl function of capitalization when you are displaying your records.

Hope this helps.

Quote Reply
Re: Title Case field In reply to
Duh.....

Here's what I get for not thinking. I added:
$rec{'Title'} =~ s/(\w+)/\u\L$1/g;

to the html_record section and it displays fine.

Couldn't figure out where to place it in db.cgi's record_validate funcion.

Anyone?
Thanks
Quote Reply
Re: Title Case field In reply to
You can try this and see if it works:

Add the following codes:

Code:
if ($rec{'Title'} =~ s/(\w+)/\u\L$1/g Wink {
$status = &validate_record;
}
else {
return "Not Correct Case";
}

Before the following codes:

Code:
if ($status eq "ok") {

in the sub add_record and sub modify_record routines in the db.cgi file.

Hope this works and helps.

Regards.


------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------