Skip to main content
February 27, 2009
Question

Update cfdiv in Parent Window from popup window

  • February 27, 2009
  • 1 reply
  • 772 views
I need help trying to update a cfdiv in the parent window from a popup window.
The parent window displays a color (red by default)

The popup gives you a radio selection which would let you select a different color.
I need to have this submit button update the cfdiv called "main" in the parent window by lby displaying the corresponding color AND I want this window to hide.
    This topic has been closed for replies.

    1 reply

    Inspiring
    February 27, 2009
    <!--- POPUP.CFM --->
    <cfif NOT structkeyexists(form, 'color')>

    <cfform action="popUp.cfm" method="post" name="form1">
    <cfinput type="radio" name="color" value="red" required="yes">Red
    <cfinput type="radio" name="color" value="blue" required="yes">Blue
    <cfinput type="radio" name="color" value="green" required="yes">Green
    <br />
    <cfinput type="submit" name="submit" value="submit">
    </cfform>

    <cfelse>

    <script type="text/javascript">
    updateColor(<cfoutput>'#form.color#'</cfoutput>);
    </script>

    </cfif>


    <!--- MAIN PAGE --->
    <!--- Add this js function to the HEAD section of the page: --->

    <script type="text/javascript">
    updateColor = function(color){
    document.getElementById('main').innerHTML = color;
    ColdFusion.Window.hide('mywindow');
    </script>

    hth

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    February 27, 2009
    Thanks but I'm getting an error as I click the submit button in the popup.

    "Error processing JavaScript markup in element mywindow_body

    Does this script look for that function in the parent window? or the same popup window?

    <script type="text/javascript" language="javascript">
    updateColor(<cfoutput>'#color#'</cfoutput>);
    </script>