Page 1 of 1
[RESOLVED] Characters in fields all UPPERCASE
Posted: Thu Oct 29, 2009 2:55 pm
by m4dbra1n
/*************************************
Title:
Version:
Author:
Demo:
Download:
Website:
Short description:
Characters in fields all UPPERCASE
*************************************/
Hi,
how can I make all chars in fields UPPERCASE?
Raven made this in his theme, some help?
Thanks in advance

Posted: Thu Oct 29, 2009 4:32 pm
by Raven
Hi, just off out so not got a lot of time to post loads but for the time being here is the code I use to make the first char uppercase

Code: Select all
onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"
It is used like this:
Code: Select all
<input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['c_name'])) {echo stripslashes(hesk_input($_SESSION['c_name']));} ?>" onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);" />
The above is for the name field in index.php but it should give you an idea.
Hope this helps

Posted: Thu Oct 29, 2009 4:50 pm
by m4dbra1n
Damn I have to learn PHP XD
I will try, but I need for all chars in the field to be UPPERCASE
I think I'll be here again

Posted: Fri Oct 30, 2009 1:21 am
by Raven
It's actually java script thats doing the changing
I found this for you:
http://javascript.internet.com/forms/al ... -case.html
*Google is your friend*

Posted: Fri Oct 30, 2009 1:37 am
by Raven
This is my code....
Name:
Code: Select all
<input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['c_name'])) {echo stripslashes(hesk_input($_SESSION['c_name']));} ?>" onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);" />
Subject:
Code: Select all
<input type="text" name="subject" size="40" maxlength="50" value="<?php if (isset($_SESSION['c_subject'])) {echo stripslashes(hesk_input($_SESSION['c_subject']));} ?>" onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);" />
Message:
Code: Select all
<textarea name="message" rows="12" cols="60" onkeyup="CheckFieldLength(message, 'charcount', 'remaining', 2000);" onkeydown="CheckFieldLength(message, 'charcount', 'remaining', 2000);" onmouseout="CheckFieldLength(message, 'charcount', 'remaining', 2000);" onblur="this.value = this.value.substr(0, 1).toUpperCase() + this.value.substr(1);"><?php if (isset($_SESSION['c_message'])) {echo stripslashes(hesk_input($_SESSION['c_message']));} ?>
</textarea>
*I have 'other' mods in the message code so please delete as required
Any questions just fire away

Posted: Fri Oct 30, 2009 1:50 pm
by m4dbra1n
Thanks Raven
Only one question: the code that you wrote is for the first uppercase letter or for make all the letters uppercase?
I need the second option and because of not be good at PHP, I'm not understanding all the code
Sorry
Posted: Fri Oct 30, 2009 6:34 pm
by Raven
Hi, the code I posted is mine which changes everything to lowercase then finally changes the first leter to uppercase. What you need is the following:
Code: Select all
onblur="javascript:this.value=this.value.toUpperCase();"
So, for the name field you would have:
Code: Select all
<input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['c_name'])) {echo stripslashes(hesk_input($_SESSION['c_name']));} ?>" onblur="javascript:this.value=this.value.toUpperCase();" />
Subject:
Code: Select all
<input type="text" name="subject" size="40" maxlength="50" value="<?php if (isset($_SESSION['c_subject'])) {echo stripslashes(hesk_input($_SESSION['c_subject']));} ?>" onblur="javascript:this.value=this.value.toUpperCase();" />
Message:
Code: Select all
<textarea name="message" rows="12" cols="60" onblur="javascript:this.value=this.value.toUpperCase();" /><?php if (isset($_SESSION['c_message'])) {echo stripslashes(hesk_input($_SESSION['c_message']));} ?></textarea>
Hope this helps matey
**EDIT**
Same applies if you you need all lower case - just use this:
Code: Select all
onblur="javascript:this.value=this.value.toLowerCase();"
I only use this one for the email field like so:
Code: Select all
<input type="text" name="email" size="40" maxlength="50" value="<?php if (isset($_SESSION['c_email'])) {echo stripslashes(hesk_input($_SESSION['c_email']));} ?>" onblur="javascript:this.value=this.value.toLowerCase();" />
P.S.
To help other users might be an idea to edit your 1st post's title to say [RESOLVED] rather than [PROBLEM] too

Posted: Mon Nov 02, 2009 11:01 am
by Raven
So m4dbra1n, did that work for you?
ok
Posted: Mon Nov 02, 2009 3:09 pm
by m4dbra1n
Raven wrote:So m4dbra1n, did that work for you?
i will try one of those days, thanks
PS:how to change the topic title? I can't do it by myself
Posted: Tue Nov 03, 2009 2:01 am
by Raven
Just view your post and click the edit button

Posted: Tue Apr 27, 2010 8:56 pm
by m4dbra1n
Hi Raven and everybody,
I'm returning on this thread to ask other help with uppercased fields.
1) How can I make all uppercase in the message area of the ticket, as it's a text area?
2) I've used the tricks you gave me, but now, every time i type something in the uppercased fields, I cannot use the return key: do I have to exclude it from the uppercase function? Which way?
Thanks in advance to everyone that can help me
