/    Sign up×
Community /Pin to ProfileBookmark

HELP – javascript – lower to UPPERcase

pls help me … i cant even solve this problem 2 days already …. me is too bad

[U]CALL FUNCTION OF JAVA[/U]

function alphaNum(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
key = window.event.keyCode;
else if (e)
key = e.which;
else
return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) ||
(key==9) || (key==13) || (key==27) )
return true;

// numbers
else if (((“0123456789”).indexOf(keychar) > -1))
return true;
[I]// alphabets

else if (((“ABCDEFGHIJKLMNOPQRSTUVWSYZ-#”).indexOf(keychar) > -1)) ( **** HERE **** )
return true;[/I]

// decimal point jump
else if (dec && (keychar == “.”))
{
myfield.form.elements[dec].focus();
return false;
}
else
return false;
}

[U]JSP[/U]

<td width=”124″ align=”right”><FONT class=”fonttype”><b>Job Plan:</b></FONT></td>
<td width=”5″><font class=”astfont”>*</font></td>

[I]<td width=”120″ height=”19″><html:text name=”myJobPlanPP_JobPlanForm” property=”jp_id” size=”10″ maxlength=”10″ onkeypress=”return alphaNum(this, event)”/></td>[/I]

<td height=”2″ colspan=”10″><html:text name=”myJobPlanPP_JobPlanForm” property=”jp_desc” size=”50″ maxlength=”50″/>&nbsp;

QUESTION:
Italic is the part that need to be changed .. ?
A) How to change input value from whatevercase to UPPERCASE n store into DB ? (Do it in JAVASCRIPT)

SYSTEM REQUIREMENT:
a. User key in input in “text field” (front-end).
b. press ‘Submit’
c. javascript will do validation for Input. (my question)
d. Input successfully stored.

EXPLANATION:
– user can key in upper n lower case in “text field”.
– system will change input into UPPERCASE format.
– only UPPERCASE can support the DB.

thanks alot ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMay 25.2005 — Just use the [b][i]stringObject[/i].toUpperCase()[/b] method.
Copy linkTweet thisAlerts:
@ah_fuiauthorMay 28.2005 — hi,

can u explain abit more please... still cant get the idea ....

  • - the text field will automatically change to uppercase when user key in smhtg.. ?


  • - use the onkeypress but how to set the function to it ???


  • thanks ?
    Copy linkTweet thisAlerts:
    @Willy_DuittMay 28.2005 — Try: [i]onkeyup="this.value=this.value.toUpperCase()"[/i]

    .....Willy
    ×

    Success!

    Help @ah_fui spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...