+ Reply to Thread
Results 1 to 5 of 5

Thread: find words and change

  1. #1
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    510
    Rep Power
    3

    find words and change

    Hi,

    If someone enters High School in a text box i want to make it H.S.

    If someone enters university in a textbox I want to make it Unv

    I tried the replace function in javascript but i think i messed it up somewhere

    Any idea

    todd

  2. #2
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    1,724
    Blog Entries
    10
    Rep Power
    11

    Could you post your code?

    And how are you calling the JS function?

  3. #3
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    436
    Rep Power
    7

    for one, post your code. for two, what if they type in Univ ... or College or etc. well, hopefully you get what i'm getting at. why not use a drop down box so that they will always be what you want them to be.
    Quote of the Month:
    Leaders: Leaders are like eagles. We don't have either of them here.

    Questions to Ponder:
    Why do banks charge you a "non-sufficient funds fee" on money they already know you don't have?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  4. #4
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    510
    Rep Power
    3

    hi,
    this is the code i have

    Code:
    if (getinstnamemem.length > 0)
    {
    getinstnamemem=getinstnamemem.replace("High School", "H.S.");
    getinstnamemem=getinstnamemem.replace("University", "Unv");
    }
    

    but if someone enters university it doesnt change it to Unv

    can someone tell me how i can make it happen

    todd

  5. #5
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    1,037
    Blog Entries
    2
    Rep Power
    13

    There is really no good way to do what you are trying to do. The number of permutations are almost infinite, even if you upper or lower case the string prior to doing the replace:
    High School
    High School
    High School
    University
    Univ.
    Univ
    are all different.
    Wolffy
    ------------------------
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary.

+ Reply to Thread

Similar Threads

  1. Change to Reputation System
    By jmurrayhead in forum Announcements
    Replies: 0
    Last Post: June 2nd, 2008, 09:57 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO