I'm working on a site that has different news article content based on specific locations; Denver, San Francisco, Florida, Idaho.  I'm creating a splash page that will be a simple form containing a dropdown of these locations that the visitor will choose and then be redirected to the chosen section; such as:
www.domain.com/denver
And this saves their selection to a cookie so that when that person visits the site again from that same computer the splash page is skipped and they are returned to their previous chosen section.
Is this possible using ChronoForms to create the dropdown that saves their selection to a cookie?
Thanks!
				
				
				
			www.domain.com/denver
And this saves their selection to a cookie so that when that person visits the site again from that same computer the splash page is skipped and they are returned to their previous chosen section.
Is this possible using ChronoForms to create the dropdown that saves their selection to a cookie?
Thanks!
					Hi hominid4,
Yes, though you'll need to add the Cookie writing code in a Custom code action.
Bob
				
				
				
			Yes, though you'll need to add the Cookie writing code in a Custom code action.
Bob
					Thanks Bob!  I have on quick question, below is a stripped down version of what I'm using and seems to work as I need but it pulls the dropdown's Label instead of the Value, I need it to pull the value. Do you by chance see offhand why that is?
Thank you!
				
				
				
			Thank you!
<html>
	<head>
		<title>Landing Page</title>
		<script type="text/javascript">
function setCookie(c_name, value, expiredays)
{
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + expiredays);
    document.cookie=c_name + "=" + escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString())
}
function GetStateLocation()
{
    var mylist = document.getElementById("myList");
    var myState = mylist.options[mylist.selectedIndex].text;
 setCookie('myState',myState,365)
    var url = "http://www.mydomain.com/";
    document.location.href = url  + myState;
}
</script>
	</head>
	<body>
		<form>
			Choose Default Location: <select id="myList">
				<option value="denver">Denver News</option>
				<option value="sanfran">San Franciso News</option>
				<option value="florida">Florida News</option>
				<option value="idaho">Idaho news</option>
			</select> <input onclick="GetStateLocation()" type="button" name="Submit" value="ENTER" />
		</form>
	</body>
</html>
					Hi homini4,
This line is getting the text instead of the value:
I'm sure that you can aimplify this using the MooTools syntax. Try this version:
Bob
				
				
				
			This line is getting the text instead of the value:
var myState = mylist.options[mylist.selectedIndex].text;I'm sure that you can aimplify this using the MooTools syntax. Try this version:
window.addEvent('domready', function() {
  $('MyList').addEvent('change', function() {
    Cookie.write('myState', $('MyList').value, {duration: 365} );
  });
});Bob
This topic is locked and no more replies can be posted.
		
	
 
  