Solved

cfselect navigation in Coldfusion Flash Form

Posted on 2010-09-17
5
458 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
COLD FUSION 6 20
ColdFusion Web Service/WSDL Connection Issue 2 75
Help please - Read an image to excel 20 59
multi page pdf 4 70
PROBLEM: How to add your own buttons to the bottom toolbar with paging info ( result count ). While creating a cfgrid, I ran into an issue where I wanted to embed my own custom buttons where the default ones ( insert / delete / etc… ) are for aes…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now