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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Florida
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trouble maintaining state of a variable being passed via query string

    Hello,

    I am trying to update an iframe when the user makes a selection from a select box.

    I don't have any trouble with changing the iframe, but when I try to send a varible as a quey string, the variable doesn't pass to the iframe properly.

    // this is in my header, and it is initiated from the onchange below.
    // it changes the page fine, but doesn't read the varible "num"
    // that was passed to the function

    <script language="javaScript">
    <!--
    function updatenotes (num) {
    document.getElementById("desc").src = 'iframe1.cfm?dec=num'
    }
    //-->
    </script>

    // this is the select box that initiates the function from onchange
    // for simplicities sake, I hard coded 3 options, but in reality,
    // these options are ever changing

    <select name="Description" onchange="updatenotes(this.options[selectedIndex].value)">
    <option name="">Select a project</option>
    <option name="2" >project2</option>
    <option name="3" >project3</option>
    </select>

    Any help you can offer would me ver appreciated.
    thanks

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try:

    document.getElementById("desc").src = 'iframe1.cfm?dec='+num

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Location
    Florida
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question thanks but that doesn't work

    Thanks, but I did try that, and when the page is sent, the variable (querystring) is just left blank. any other ideas?

  • #4
    New to the CF scene
    Join Date
    Sep 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you can't be bothered to explain why but we are supposed to be bothered to help? Just as well we are not as lazy as you.

    As havoc said the font tag is one way but inline styles are more acceptable these days. Just echo the style="color:red;" bit inside the HTML tag.

    And this is absolutely brilliant. Really your post is very good for clearing my concepts. Recently i have finished my 1z0-052 exam, which i appear for attaining the certification. Although! it was not so hard to get certified but the study kept me busy whole summer. I've also attained certification of another course of XK0-002 exam which I had passed last three months back. In the same time I have completed my thesis project of 70-444 exam which I will going to submit it soon. I really enjoyed my stay over here and gain useful knowledge which I am sure will work for me.

  • #5
    Senior Coder ckeyrouz's Avatar
    Join Date
    Jun 2009
    Location
    Montreal, Canada
    Posts
    1,044
    Thanks
    5
    Thanked 179 Times in 179 Posts
    what is the object with id "desc", is it a frame or iframe or what?

    After checking the initial post I saw it is an iframe so you try this:

    Code:
    parent.frameName.location.href = 'iframe1.cfm?dec='+num
    Software and cathedrals are much the same - first we build them, then we pray.


  •  

    Posting Permissions

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