Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
textTransform doesn't, not really
Old 08-19-2009, 08:30 PM textTransform doesn't, not really
dday76's Avatar
Novice Talker

Posts: 8
Name: JDT
Trades: 0
// Hi! first post here. I searched 'textTransform' and didn't get any results, so here's the new post

A'ight - I have successfully transformed text
document.getElementById(tgt.id).style.textTransfor m="capitalize";
as part of a function triggered by an onblur event
onblur="checkcase(this)"
This changes the value of an input box from lower to Sentence case
jason => Jason
But it's not really changed... It just looks like it's changed.
By that I mean:
1) the client-side javascript function will continue to read 'jason' rather than 'Jason' even after the transform (confirmed with an alert box for the value)
2) the server-side PhP email to which the form sends data (by way of a submit button) sends 'jason' rather than 'Jason'.

Seriously... is it supposed to be like this? Why would it be like this? And at the very least... how can I transformText for reals*?

Jason
* for reals = so my js and PhP see the 'Jason' not 'jason'
dday76 is offline
Reply With Quote
View Public Profile Visit dday76's homepage!
 
 
Register now for full access!
Old 08-24-2009, 02:24 PM Re: textTransform doesn't, not really
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
It is acting correctly. When you change the textTransform property, all are doing is manipulating the CSS text-transform property, which causes the text to display a certain way, though the text is in reality however it was originally.

If you want the text to ACTUALLY transform, you'll need to do it manually, with some text manipulating code:
Code:
text = document.getElementById(tgt.id).innerHTML;
text = text.charAt(0).toUpperCase() + text.substr(1);
Something like that should work handily.

But easier, since you're using PHP on the server side, would to be just manipulate the received data before sending it, with PHP's ucfirst() or ucwords() function.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 08-25-2009, 12:03 AM Re: textTransform doesn't, not really
dday76's Avatar
Novice Talker

Posts: 8
Name: JDT
Trades: 0
Quote:
Originally Posted by wayfarer07 View Post
But easier, since you're using PHP on the server side, would to be just manipulate the received data before sending it, with PHP's ucfirst() or ucwords() function.
Thanks. In the end, I did do ucwords, plus lots of angry emails to docjs - textFakeyTransform not textTransform.
dday76 is offline
Reply With Quote
View Public Profile Visit dday76's homepage!
 
Old 08-25-2009, 07:35 AM Re: textTransform doesn't, not really
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
see the part in red?
document.getElementById(tgt.id).style.textTransform="capitalize";

Any time you are manipulating a node's style object, the result is a manipulation of that element's inline CSS rules. CSS properties which would have been expressed with a dash (font-weight, font-size, list-style, margin-top, etc.) are expressed in camelCase. This could be a good lesson for you, since manipulating styles is a key element of client-side JavaScript.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to textTransform doesn't, not really
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.34940 seconds with 12 queries