Solved

cfselect navigation in Coldfusion Flash Form

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trying to deCrypt CSV file using coldfusion 29 168
coldfusion grab more the one form field to make an insert 3 48
Coldfusion cfscript DELETE function 7 28
Combining Queries 7 27
PROBLEM:  How to open a cfwindow or run a function on double click of a cfgrid row. One of my clients wanted to be able to double click on a row item to get more detailed information about a transaction and to be able to modify the line items i…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

860 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