1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

noob java script issue

Discussion in 'JavaScript' started by bthomas312, Jun 23, 2011.

  1. #1
    I have an issue on my site that i can get working, I am trying to use java script to submit a html form and set a value to an input when it does, I have it set up and it is working for one part but not another part of the site that I set up the same way, the only difference is that the part that is not working is a string and the part that is working is an int, I have tried playing around with " marks and cant seem to get it to work right...

    Here is that javascrip :
    //this is the part that works


    function getDreamUser(DreamUser)
    {
    document.DreamUserform.Catogeory.value = DreamUser;
    document.DreamUserform.submit();
    }



    and here is the html
    SEMrush
    <form name='DreamUserform' method='post' action='UserView.php'>
    <input type='hidden' name='Catogeory' />
    <a href=javascript:getDreamUser(testname)>testname</a>
    </form>
     
    bthomas312, Jun 23, 2011 IP
    SEMrush
  2. bthomas312

    bthomas312 Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    i found the way to do it, I just thought I would post the fix.

    function getDreamUser(DreamUser)
    {
    document.DreamUserform.Catogeory.value = String(DreamUser);
    document.DreamUserform.submit();
    }



    and here is the html

    <form name='DreamUserform' method='post' action='UserView.php'>
    <input type='hidden' name='Catogeory' />
    <a href=javascript:getDreamUser('testname')>testname</a>
    </form>
     
    bthomas312, Jun 23, 2011 IP