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

    <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
  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