Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Location
    NC
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Passing a value from combobox to text link

    Hi all,
    Here is what I'm trying to do and can't find the code for it anywhere..

    Combo box with integer values, ie

    <select name="monthIDs">
    <option value="">select month
    <option value="1">January
    <option value="2">February
    ... etc
    </select>

    Next to the combo I want a link *view details* That opens a popup window with content specific to the selected month.

    I do not want to submit the form, but allow the viewer to see what is in each of the months just by selecting the month from the combo and then click on the link next to it.

    Any ideas of where to look?

    TIA
    Spidey

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    take a look at this demo, maybe is what you want:

    http://www.xul.fr/en-xml-ajax.html#ajax-get-body

    best regards

  • #3
    New to the CF scene
    Join Date
    Dec 2007
    Location
    NC
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes and no. I know how to pass a simple text value with Javascript, but I need to pass the value to a link. It can be done with simple Javascript, but for the life of me I haven't been able to get it to work.

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by SpiderWoman View Post
    Yes and no. I know how to pass a simple text value with Javascript, but I need to pass the value to a link. It can be done with simple Javascript, but for the life of me I haven't been able to get it to work.
    A simple text value could be computed or a piece of code,

    Code:
    '<a href="http://your.link/page?arg=' + value + '">your link text</a>'

  • #5
    New to the CF scene
    Join Date
    Dec 2007
    Location
    NC
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    getting there...
    now complicating this... this is what I have now...

    Code:
    <html>
    <head>
    <title>Set Message</title>
    <script language="JavaScript">
    myarr=new Array()
    myarr[1]='<a href="includes/inc_viewrule.cfm?rulesid=1">your link text</a>'
    myarr[2]='<a href="includes/inc_viewrule.cfm?rulesid=2">your link text</a>'
    myarr[3]='<a href="includes/inc_viewrule.cfm?rulesid=3">your link text</a>'
    myarr[4]='<a href="includes/inc_viewrule.cfm?rulesid=4">your link text</a>'
    myarr[5]='<a href="includes/inc_viewrule.cfm?rulesid=5">your link text</a>'
    function doIt(objval)
    {
    document.getElementById("msg").innerHTML=myarr[objval]
    }
    </script>
    </head
    <body>
    <form name="myform">
    <select name="searchin" onChange="doIt(this.options[this.selectedIndex].value)">
    <option value="1">First link</option>
    <option value="2">Second link</option>
    <option value="3">Third link</option>
    <option value="4">Fourth link</option>
    <option value="5">Fifth link</option>
    </select>
    <span id="msg">First link</span>
    </form>
    </body>
    </html>
    This works OK. Now if I want to show the popup window as a greybox, the code that I use for that won't work now..

    This is the normal <a href> code for it

    Code:
    <a href="includes/inc_viewrule.cfm?rulesid=1" onclick="return GB_show ('View Rule', 'includes/inc_viewrule.cfm?rulesid=1', 650, 650)" style="text-decoration:underline;">
    I've removed the dynamic variables from it to make it look simpler. When I put that in instead of the *plain* link, the text won't change and therefore the link won't show up either.

    Any ideas?

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    check this, and tell me if is what you expect:

    http://sort-of.homelinux.org/combotest.html

    I could be wrong but I think it work.

  • #7
    New to the CF scene
    Join Date
    Dec 2007
    Location
    NC
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by oesxyl View Post
    check this, and tell me if is what you expect:

    http://sort-of.homelinux.org/combotest.html

    I could be wrong but I think it work.
    That is pretty much it and I have that working as well, but once you change the link to open a greybox link, then the problems start

  • #8
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by SpiderWoman View Post
    That is pretty much it and I have that working as well, but once you change the link to open a greybox link, then the problems start
    what kind of problem?

    As far I see from my server log:

    In errror log:

    "File does not exist: .../includes/inc_viewrule.cfm"

    In access log is a request:

    "GET /includes/inc_viewrule.cfm?rulesid=5"


    the error is normal and the rulesid=5 is passed to the server so I guess it work,

    The only thing I have done was to escape the "'" and assign the myarr array with your link

    Code:
    myarr[1]='<a href="includes/inc_viewrule.cfm?rulesid=1" onclick="return GB_show (\'View Rule\', \'includes/inc_viewrule.cfm?rulesid=1\', 650, 650)" style="text-decoration:underline;">
    best regards

  • #9
    New to the CF scene
    Join Date
    Dec 2007
    Location
    NC
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THAT WORKS!!!!! I could kiss you right now

    You saved my evening

  • #10
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by SpiderWoman View Post
    THAT WORKS!!!!! I could kiss you right now

    You saved my evening
    , I'm glad to help.

    best regards

  • #11
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by oesxyl View Post
    check this, and tell me if is what you expect:

    http://sort-of.homelinux.org/combotest.html

    I could be wrong but I think it work.
    Edit: 01/14/2008 - I remove content of the link, because is useless, from the server, and the red link from post #6 and #7 is invalid, see #5 and #8 from this thread for solution, read all thread or post a specific question.
    Last edited by oesxyl; 01-14-2008 at 12:29 PM.

  • #12
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    though the thread is a month old...i couldn't help :| but notice the misguided usage of an array

    Code:
    function doIt(objval)
    {
    document.getElementById("msg").innerHTML='<a href="includes/inc_viewrule.cfm?rulesid='+objval+'">your link text</a>';
    }
    is all you need
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow


  •  

    Posting Permissions

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