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

Set session var using js

Participant ,
Dec 02, 2009 Dec 02, 2009

Copy link to clipboard

Copied

Hi all, I have small js that is being called when a radio button is clicked. I need that to set a cf session var which will have the radio value so that when the page refresh it will remember what is selected...

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<cfif cgi.PATH_TRANSLATED CONTAINS 'index.cfm'>
  <cfoutput>
   <META HTTP-EQUIV="refresh" content="60;URL=http://#HTTP_HOST#/NEA/index.cfm?location=ALL">
  </cfoutput>
</cfif>

         <script type="text/javascript">
         function select_location(select_me){
          window.location ="index.cfm?location=" + select_me.value;
         }
         </script>
         <input  <cfif url.location eq "NM">checked="checked"</cfif> type="radio" name="location" id="NM" value="NM" onClick="select_location(this);"><label for="NM">NM</label> 
         <input  <cfif url.location eq "SM">checked="checked"</cfif> type="radio" name="location" id="SM" value="SM" onClick="select_location(this);"><label for="SM">SM</label> 
         <input <cfif url.location eq "BQ">checked="checked"</cfif> type="radio" name="location" id="BQ" value="BQ" onClick="select_location(this);"><label for="BQ">BQ</label> 
         <input <cfif url.location eq "MV">checked="checked"</cfif> type="radio" name="location" id="MV" value="MV" onClick="select_location(this);"><label for="MV">MV</label> 
         <input <cfif url.location eq "SI">checked="checked"</cfif> type="radio" name="location" id="SI" value="SI" onClick="select_location(this);"><label for="SI">SI</label> 
         <input <cfif url.location eq "BR">checked="checked"</cfif> type="radio" name="location" id="BR" value="BR" onClick="select_location(this);"><label for="BR">BR</label> 
         <input <cfif url.location eq "HV">checked="checked"</cfif>  type="radio" name="location" id="HV" value="HV" onClick="select_location(this);"><label for="HV">HV</label>
         <input <cfif url.location eq "ALL">checked="checked"</cfif> type="radio" name="location" id="ALL" value="ALL" onClick="select_location(this);"><label for="ALL">ALL</label><br>

TOPICS
Advanced techniques

Views

754

Translate

Translate

Report

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 ,
Dec 02, 2009 Dec 02, 2009

Copy link to clipboard

Copied

JavaScript runs on the Client.  ColdFusion runs on the server.  They do not talk to each other or share memory.

The only way to get data from the client to the server is to make a request.  The only way to get data from the server to the client is to respond to a request.

You can make that request by submitting a form either in the get or post scope.

You can make that request by sumitting a request with the xmlHTTPrequest() function, commonly called AJAX.

But somehow or the other you have to make a request.

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 03, 2009 Dec 03, 2009

Copy link to clipboard

Copied

You didn't ask any question. Are you double, Emmim44?

Votes

Translate

Translate

Report

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
Community Expert ,
Dec 03, 2009 Dec 03, 2009

Copy link to clipboard

Copied

Set session var using js

Yes, it is possible to use Javascript to navigate to a page in which session variables are set. There.

Votes

Translate

Translate

Report

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
Participant ,
Dec 03, 2009 Dec 03, 2009

Copy link to clipboard

Copied

LATEST

I will have to check some samples...if u have one handy, pls feeel free

Votes

Translate

Translate

Report

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
Documentation