Results 1 to 5 of 5
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    javascript toUpperCase function

    I have a need to convert user-entered values on a webform to uppercase and thought Javascript would be the easiest way to mess with it. being supremely lazy, I wanted to just do it all in a one-line like this:

    onblur="java script: toUpperCase(MyForm.FormItem.Value)"

    but it no worketh. I suspect I need to build a little function separately that returns the value, but that means slightly more work... or perhaps there's some little thing I'm missing here?

    TIA

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: javascript toUpperCase function

    Hi Steve

    Long time no speak, could this work?

    function makeUppercase() {
    document.form1.instring.value = document.form1.instring.value.toUpperCase();
    }

    .....


    < form name="form1" id="form1" method="post" action="">
    < input name="instring" type="text" onBlur="makeUppercase();">
    < input type="text" name="textfield" />
    < /form>

    ..........

    PS spaces between < and >
    Jerry

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: javascript toUpperCase function

    looks good. hmmm...instring? wasn't aware of that one. of course, i don't have an actual javascript reference book around.

    i'll give it a shot! thanks!

  4. #4
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: javascript toUpperCase function

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>instring is the name of the text box..I couldn't think of another name...you could call it what you want
    Jerry

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: javascript toUpperCase function

    thanks for the tip. i thought it might be a javascript keyword for, like, grabbing the contents of the form textbox or summthin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •