?
Solved

cfselect navigation in Coldfusion Flash Form

Posted on 2010-09-17
5
Medium Priority
?
465 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 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

765 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