[RESOLVED] Characters in fields all UPPERCASE

Everything related to Hesk - helpdesk software

Moderator: mkoch227

Post Reply
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

[RESOLVED] Characters in fields all UPPERCASE

Post 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 ;)
Last edited by m4dbra1n on Tue Nov 03, 2009 2:53 pm, edited 1 time in total.
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post 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 :)
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

Post 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 :)
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post 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* :P
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post 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 ;)
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

Post 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
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post 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 ;)
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

So m4dbra1n, did that work for you?
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

ok

Post 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
Raven
Posts: 172
Joined: Sat Jun 20, 2009 12:39 am

Post by Raven »

Just view your post and click the edit button ;)
m4dbra1n
Posts: 60
Joined: Sun Oct 04, 2009 10:33 am

Post 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 :wink:
Post Reply