Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

url variable in pop up window

Guest
May 19, 2009 May 19, 2009

Hi,

I`m just experimenting here..

  • In a flash form I got a hidden field that is bound to a select box
  • I got a button that calls some javascript to open a popup window
  • I want the url variable to hold the value of the hidden field when the button is pressed

     I have no idea if this can even be done in this way, I`m guessing not. Maybe there is a way to bind the hidden field to the url variable using javascript or action script? Any ideas would be cool..

963
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 19, 2009 May 19, 2009

HTML field value is accessible in JavaScript.

The JavaScript code to open the popup windows uses this value in the URL of the window.

Nothing tricky required here.

<script>

...

   var jsVar = document.getElementById("IDofTextControl").value;

   window.open("www.url.com?urlVar=" + jsVar,....);

...

</script>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2009 May 19, 2009

Ahaa thats pretty cool, thanks.

It would be great to do the same thing but with flash forms.

Is javascript able to access the element id and value of a flash form field? It doesnt work when I try it so maybe there is another trick?

Thaks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 19, 2009 May 19, 2009

Flash is different.  Flash isn't just markup, but an executing application.  There are ways to pull data from and push data into a flash object.  I'm affraid I can not provide such code though as I have never tried.  But I bet with some Google searching, code can be found.

You might also gain some insight by examining the JavaScript and|or Actionscript generated for the webpages when the Flash form is delivered by ColdFusion.

HTH

Ian

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 21, 2009 May 21, 2009

Thanks for you advice Ian,

I managed to come up with a solution

Its similar to the javascript function you posted.

In the flash form I can add actionscript to the select box onChange attribute.

<cfform format ="flash">

<cfselect name="name" query="thequery" value="thevalue" display="whatever">

onChange="getUrl('supportdetails.cfm?ticketnumber=' + categorysubject.dataProvider[categorysubject.selectedIndex]['data'],'_blank');

</cfselect>

</cfform>

Now there is no need for a hidden field or a cfbutton.. 🙂

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 21, 2009 May 21, 2009
LATEST

.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 19, 2009 May 19, 2009

Here is a code example..

<cfsavecontent variable="ticketpopup">
    getURL("javascript:window.open('supportdetails.cfm?id=#theid#' , 'TicketDetails', 'width=900,height=630, Scrollbars=1, resizable=0'); void(0);");  </cfsavecontent>

<cfselect name="selectbox" query="thequery" value="id" display="whatever"></select>

<cfinput type="hidden" name="theid" bind="{selectbox.selectItem.data}">

<cfinput type="button" name="mybutton" value="whatever" onClick="#ticketpopup#>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources