Solved

cfselect navigation in Coldfusion Flash Form

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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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