Solved

cfselect navigation in Coldfusion Flash Form

Posted on 2010-09-17
5
464 Views
Last Modified: 2012-05-10
I have a a flash form with a cfselect. Depending on the option selected I would like to navigate to another page. For example, I have three options...

<cfselect name="myselect">
    <option value="1">Item 1</option>
    <option value="2">Item 2</option>
    <option value="3">Item 3</option>
</cfselect>

If item 1 or item 2 is selected I simply want the select to behave normally and submit the selected value when the form is passed. If, however, item 3 is selected I want to redirect the user to another page entirely.
0
Comment
Question by:pcmelby
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 52

Assisted Solution

by:_agx_
_agx_ earned 500 total points
ID: 33704852
There are probably other ways. But a simple call to getURL() works
http://www.coldfusionjedi.com/index.cfm/2005/9/12/Ask-a-Jedi-Opening-a-new-window-from-a-Flash-Form


<script>
      function goToPage(newURL) {
      if(newURL != '') window.location.href = newURL;
      }
</script>
<cfform format="flash" name="foo" width="400" height="200">
      <cfformitem type="script">
            function checkSelectedItem(value) {
                  if (value == "3") {
                        getURL('javascript:goToPage(\'someOtherPage.cfm\')');
                  }
            }
      </cfformitem>
      <cfselect name="myselect" onChange="checkSelectedItem(myselect.selectedItem.data)">
          <option value="1">Item 1</option>
          <option value="2">Item 2</option>
          <option value="3">Item 3</option>
      </cfselect>
</cfform>
0
 

Accepted Solution

by:
pcmelby earned 0 total points
ID: 33708724
Thanks! Is there any reason you couldn't eliminate the javascript bit and just do this?

<cfform format="flash" name="foo" width="400" height="200">
      <cfformitem type="script">
            function checkSelectedItem(value) {
                  if (value == "3") {
                        getURL('http://www.someotherpage.com');
                  }
            }
      </cfformitem>
      <cfselect name="myselect" onChange="checkSelectedItem(myselect.selectedItem.data)">
          <option value="1">Item 1</option>
          <option value="2">Item 2</option>
          <option value="3">Item 3</option>
      </cfselect>
</cfform>

I tested it and it works. Just wondering if there's a reason for adding the javascript that I'm missing.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33708781
Nope, no reason ;)  Just a bit of Friday laziness
0
 

Author Comment

by:pcmelby
ID: 33730161
Sorry, I didn't mean to close the ticket this way. I just wanted to award the points to aqx but also show my last answer as part of the solution.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 33738635
Yeah, I'm always a little confused on how to properly close questions ;-) I think EE automatically handles it a little differently when one of your own comments is selected as the answer.  But it looks okay to me.
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question