Closing a CFwindow and reloading calling page using javascript

I have a inquiry page Results_mine.cfm that allows the user to define variables for a query.  I want to save off the variables upon the click of the "Save as New" button that calls the javascript function below.  The javascript function (below) calls a form allows a user to create a name for the inquiry and save off the values.  The call to the Results_Save.cfm?nUserResultID='+vv works perfectly when the form is posted; name and variables get written to the database. However at the end of the post within the Results_Save.cfm? I have the following code which I was hoping would shut the window and refresh the calling window;

<script>
ColdFusion.Window.show('SaveResults');
document.location.replace('ResultsConsole.cfm');
</script>

For some reason the code is ignored....I have tried alerts and it just isn't reading the javascript.

Ideally I really just want to shut the window and then just refresh the a dropdown cfselect on the calling page.  Problem is window is not shutting and the page is not getting refreshed.  

The questrion is why isnt the javascript being interpreted and Is it possible to bind the cfselect to give it the new value. upon insert into the database so I do not have to do a total page refresh?

at the end however within the calling page I have put a

function savenewform() {
	vv = "";
    v1 = document.resultsform.nCircuitID.value ;
    v2 = document.resultsform.nShowID.value ;
    v3 = document.resultsform.nDivisionTypeID.value ;
    v4 = document.resultsform.nClassTypeID.value ;
    v5 = document.resultsform.nHorseID.value ;
    v6 = document.resultsform.nRiderContactID.value;
    v7 = document.resultsform.nTrainerContactID.value ;
    v8 = document.resultsform.nOwnerContactID.value;
    v9 = document.resultsform.nTripRank.value;
    v10 = document.resultsform.nPrizeMoney.value;
    v11 = document.resultsform.nScores.value;
    v12 = document.resultsform.nFaults.value;
    v13 = document.resultsform.nYear.value;
	v14 = document.resultsform.nMonth.value;
    v15 = document.resultsform.nClassID.value;
    v16 = document.resultsform.nVideoFlag.value;
 
 
    ColdFusion.navigate('http://equestriansports.brandwise.com/brandwise/templates/espcustom/classes/Results_Save.cfm?nUserResultID='+vv
						+'&V1='+v1+'&V2='+v2+'&V3='+v3+'&V4='+v4+'&V5='+v5+'&V6='+v6+'&V7='+v7+'&V8='+v8+'&V9='+v9+'&V10='+v10+'&V11='+v11+'&V12='+v12
						+'&V13='+v13+'&V14='+v14+'&V15='+v15+'&V16='+v16
						,
						'SaveResults');
  	ColdFusion.Window.show('SaveResults');
}

Open in new window

ESPMJBAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

azadisaryevCommented:
if i understand you correctly, try this:

add this js function to the HEAD section of your main page (i.e. NOT the page loaded in cfwindow):

onSaveResults = function() {
ColdFusion.Window.show('SaveResults');
document.location.replace('ResultsConsole.cfm');
}

then add this line before the closing </body> tag in the page that IS loaded in cfwindow:
<cfset ajaxonload('onSaveResults')>


on your second issue - refreshing just the drop-down select instead of whole page - read this:
http://cfsilence.com/blog/client/index.cfm/2007/10/22/Refreshing-A-Bound-CFSelect

hth

Azadi
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
azadisaryevCommented:
hmm...
ColdFusion.Window.show('SaveResults') should probably instead be ColdFusion.Window.hide('SaveResults'), no? you want to 'close' the window, not show it, right?

Azadi
0
ESPMJBAuthor Commented:
Azadi
Once again, thanks for your great help, the first section did work.
On the link you sent me to it refers to the following;

"The getArt() function returns a query to the select which uses the 'value' and 'display' columns as defined in the cfselect tag.

<script>
getArt = function(){
var a = new artClass();
var artists = a.getArtistsForSelect();
return artists;
}
</script>

How does the javascript  "a.getArtistsforSelect()" function call a query? Is getArtistsforSelect the name of a query?
0
ESPMJBAuthor Commented:
Azadi
Maybe this is a simpler question that accomplishes the same result.

I want a CFSelect to with an "onchange" call to a javascript function that does the following;
call a query for a selected id within the cfselect.  The query would return a record with three values
ID1, ID2, ID3.  For example

<CFQUERY NAME="GetSearches" DATASOURCE="xyz">
select nID1,ID2,ID3 from searchlist
where searchlistID = 1
</CFQUERY>       

I then want to assign those new values to the current form as follows;  
    document.resultsform.ID1.value = "x";
    document.resultsform.ID2.value = "y";
    document.resultsform.ID3.value = "z";
   
can you easily make the call to the query or a cfc so I can refresh the form without reloading the page?

Any help on this would be greatly appreciated!!!

 
0
ESPMJBAuthor Commented:
Thanks again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.