For this code:
page1.cfm
<form action="page2.cfm" method="post">
<input type="text" name="name" />
<input type="submit" />
</form>
page2.cfm
<cfset session.name = form.name>
<cflocation url="page3.cfm" addtoken="no">
page3.cfm
<cfdump var="#session.name#">
If you do this:
browse to page1.cfm on any browswer
submit the form with "value1"
open a new tab
browse to page1.cfm and submit the form with "value2"
go back to the first tab and refresh the page
You will notice that the value of session.name changes on the first tab.
In this question, one of the answers is followed by the comment, "If tabbed browsing causes issue with your session variables, you are doing it wrong".
How then, do you do it properly? The objective is to preserve "value1" on the first tab and "value2" on the second.
Hopefully Scott will post his own comment/answer here but I suspect you misinterpreted his comment. What you describe here is exactly how browsing has always worked for me. Before "tabbed" browsing existed this same issue arose when you opened a new browser window without closing the existing one (this happens no matter how many browser windows you open and still happens today). The ColdFusion server will only maintain a single session for every browser instance the user has open. Hence the warning that all of us display when a user logs out of a session based application. Something along the lines of "your session will not be completely closed until you exit all of your browser windows". Or when they log in "you already have an active session, your other session will be terminated". Then came tabbed browsing. Well tabs are nothing more than another browser instance, just like before, only contained within the same window.
So tabbed browsing does not cause an issue with session variables, they are working as designed. This is how it works. This is expected behavior. It is your expectation that is wrong. I am sure there are ways to make it work the way you are expecting, like there always is in programming, but that is going against the way browsers are designed. Is that a direction you really want to go?
Duplicate question - How to differ sessions in browser-tabs?. You will see some examples there but they are all hacks in an attempt to make it work differently than designed.
Related
My site using URL Rewrite to make SEO friendly URLs. This makes self-posting a form back to the same page a little tricky.
However in ColdFusion I do this for the form's action attribute:
<form name="formSortBy" method="post" enctype="multipart/form-data" action="#StructFind(GetHttpRequestData().headers, 'X-Original-URL')#">
</form>
The important part here is the #StructFind(GetHttpRequestData().headers, 'X-Original-URL')# which gets me the URL of the page.
However the X-Original-URL key just doesn't exist on some pages so I get an error from ColdFusion saying:
Cannot find X-Original-URL key in structure.
The specified key, X-Original-URL, does not exist in the structure.
This is happening when I click to go to the homepage of a section I am in.
So X-Original-URL exists if I go to http://www.sitename.com/products/gaming but it won't exist if I go just to http://www.sitename.com/products
Is there anyway to get around this or make it work like I need it to?
Sounds like there is an issue between your rewrite rules and CF.
But, there is an easy fix - you can get a form to post to itself by simply not specifying the action attribute.
I want to create a simple registration form as one of the pages in my Joomla 2.5 website.
Every where on the internet, I see people asking me to use an extension like proforms, ckforms etc.. Most of the have price tags on them and the free ones do not have database and I don't really want a lot of functionality.
I just want the following code to work. So that I can pull the POST variable and insert them in a db.
<form method="post" action="mycreatedpage.php">
<input type="text"/>
<input type="submit">
</form>
Is this not possible in Joomla 2.5?
After a bit more searching, I realized that what I really needed was an ability to make PHP run inside the article. Thanks to a video.
Answer :
Install Sourcerer to enable PHP inside joomla articles
Create an article which take in the POST variable and insert into the database. This is the tricky part. What I did here was take the general PHP code which I would have written in register_do.php and insert it using the Sourcerer plugin.
Now create an menu Item which points to the above article. Save the menu item and copy the alias. This alias will be the action for the form.
From here on on, everything must work fine.
For more detailed instructions, watch the video
When you post a form, you have to have some code to handle the form input and what to do with it. So your options are to write a component to handle that form input or to use a form component that does it for you. If you write your own there is a lot to consider unless you want to open up gaping security holes in your website.
There are plenty of free forms components available. If you want free, I would recommend Chronoforms, if you don't mind paying small fee then RS Forms.
I keep getting this "Element TSHIRTOPTION is undefined in Form" Error when page first loads up. The radio button values work when I click on each one. When I refresh the browser, error doesnt appear again until I click on link again (like when the page loads up the first time). I have one of the radio buttons "preselected" hoping to solve the undefined error, but no help there. Any suggestions?
A couple of things could be happening here:
your query is running before the form is submitted - make sure your UPDATE only executes after the form is submitted run query
you are trying to use the form.TshirtOption variable before it is defined as in the radio button itself:
<cfif form.TshirtOption is "radio"><cfset checked = 'checked="checked"'/></cfif>
<input name="radio" type="radio" id="radio" value="radio" #checked# />
OR - you are trying to use the variable out of scope i.e. form.TshirtOption vs TshirtOption
we might need to see your full source, but basically you probably need to give the variable a default before you try to use it:
<cfparam name="form.TshirtOption" value="" />
-sean
Code would be helpful, but I bet a
<cfparam name="form.TSHIRTOPTION " default="your_default_value"/>
at the top of the page would fix you right up. :)
Hey guys I am having an issue when I'm trying to display a cfdiv inside a cfwindow. It just doesn't show up. No errors, nothing to tell me I'm doing something wrong. The div works just fine if I display it in the page outside of the cfwindow. The cfdiv binds to a page that displays notes. If I try to do a cfinclude with the page the cfdiv binds to I get an error saying that the template can't be found, or there needs to be a mapping. I also have a cftext area inside a cfform and I'm trying to do richtext with it, however it doesn't work either inside of the cfwindow. Is cfwindow incapable of doing this, or is there a trick I don't know about. If you need any other information I'll be happy to provide it.
<cfdiv bind="url:/admin/notes/noteDiv.cfm?noteCategory=businessListing#url.listingID#" id="noteDiv">
On the page with the cfdiv you need to add:
<cfajaximport tags="cfform">
That will load up the required Javascript scripts to make cfform work within a window.
fully qualify your path and it will work. I just ran into this issue. I have a cfdiv inside a cfwindow
<cfdiv
id="idGoesHere"
name="nameGoesHEre"
style="height:300px;width:300px;display:none"
bind="url:http://serverName.att.com/folder/NotesTab_Ajax.cfm?Note_Tag_Type_Code={Tag_Note_Type#change}&case=buildAvailableTagList"
bindOnLoad="false"
/>
for some reason stepping the URL back a directory worked too ../folder/NotesTab_Ajax etc
Might need to pull in cfdiv from that cfAjaxProxy call as well.
When I post a comment with the django's comment framework, I have a hidden next value set in hopes that once the comment is posted, it will bring the user to view their own comment. The next field renders like this:
<input type="hidden" name="next" value="http://example.com/item/1#c23" />
However, when a comment is posted, django is adding a ?c=23 to the end of the url so the fully formed url that the user is redirected to becomes:
http://example.com/item/1#c23?c=23
In Firefox and Safari (brief testing) this prevents the page from moving down to the correct id=23 and just shows the very top of the page (I want it to show the just posted comment). Removing the ?c=23 fixes the problem (by hand) but I don't know how to tell Django to stop adding it.
Ideas?
Not a solution to your problem but just wanted to add that this is a bug in Django. It would be great if you could open a ticket for it.
For 1.1, it seems ticket 10585 took care of already existing query strings in the next value. That is, if next was http://example.com/item/1?a=1 then it became http://example.com/item/1?a=1?c=23 after a comment was posted. The code changes look pretty simple so you might even be able to provide a patch yourself.
Good luck!
Update February 27, 2011: Looks like ticket 13411 has a patch attached!
This jQuery line allows you to change the current URL:
$(this).attr("href", "NEW_URL");
Replace NEW_URL by the new URL. You can split http://example.com/item/1#c23?c=23 using the question mark and then use the first part of the array as the new URL.