Forum Moderators: open
Do you not specify an action inside the form tag when it posts to itself?
Well at my company we use this logic in all of our form validation so that if the form comes back as incomplete all its values are easily retrievable.
It has just come to our attention that the new Safari Browser for the Mac, now that IE has left the Mac OS, will redirect to the front page of a site if a form is submitted without a specified action.
In all browsers, currently if you have a form tag with no action it will submit to itself. This will not be the case with the new Safari and Konquerer browsers.
I dont know about your sites but I know mine all need to have changes made so that forms that are posting to themselves have an action that will specify the page as the action. Over 350 sites that we manage will need this new change on at least one page per site, some of our shop sites have 50-100 pages where this change will be needed.
Thanks Mac for abandoning even more of your users from a nice web surfing experience. Like we devolpers don't have enough consessions to make in our code to accomodate your users
In case my anger has masked the meaning of this post, here is a summary.
<form method="post">
This will now submit to the front page of a site in the new Safari and Konquerer. Where as before ANY and EVERY browser would post the form to the page it came from.
Be warned it seems like soon we will need 2 URLs for every site, one for Mac users and one for everyone else.
Also, I've found that Safari and NS7 (for Windows) behave the same. If you check your logs, the UA for Safari says "like Gecko" so you may want to download a version of NS7 and see if it may be your code and not Safari. (just a suggestion)
But action= is a required part of the <form> definition:
[w3.org...]
You've got away with using a quirk, and you now have the first indication that it won't work in the future. Today MACs, tomorrow all browsers?
Both browsers are solid, and both will get much better over time. Let's remember that Safari is only in the public domain for just under a year. If you check out Dave Hyatt's blog on Mozillazine.org you can see what they are working on for future releases, if that is of any help.
I know that W3 lists it as 'required' but when all browsers do it one way why start going away from that?
We had an earlier issue where safari would give a cookie the value of 'deleted' rather than deleting the cookie. This was causing all sorts of problems and I seem to have more and more code that does one thing for mac and another for everyone else.
We need more continuity among browsers we don't need them all doing different things.
Don't get me wrong I am not bashing any one browser, if I were it would be IE I promise you that. But I don't get why they are basing the new Konquerer and Safari on an unused browser.
We need more continuity among browsers we don't need them all doing different things.
However the only way for browser compatability is a standard. As borowsers become more standards compliant we will (and are) seeing greater compatability.
Therefore as has been said in almost every forum here it is "best practices" to write clean code and only then make adjustments for non-compliant browsers.
It may be of benefit to validate your sites (as time permits!) so that you are able to pre-empt future problems. The web and how we view it is in constant change - NN4 is not that long ago, neither is IE3, nor for that matter Mozaic.
The only protection we, as webmasters, have is standards compliance; without valiadation and compliance the chaos that would accompany browser change would be horrendous.
It's not just Safari that requires this, and not just FORMs - I had some sites from 4-5 years ago where I was using <A href=""> which now doesn't work in IE - you have to use <A href="/"> or similar.
So IE broke the standard in the last few years - quel surprise! That's why one of the golden rules of web development is to NEVER develop in IE.
There are a bunch of other bugs [dhtmlkitchen.com], some rather interesting.
This will now submit to the front page of a site in the new Safari and Konquerer. Where as before ANY and EVERY browser would post the form to the page it came from.
I've been using Safari for about the past month, and I've never encountered any problems with any website.
...and they're being fixed [weblogs.mozillazine.org]!
<?PHP
echo "$PHP_SELF"; # address of current page
?>
You can achieve the same using other languages, but probably not as easily.
Look at the output of your REQUEST object, there should be a object in there that has the URL of the current page you are on. In mine it is URL1. It always equals the URL of the page I am on. so my <action="REQUEST.URL1"> depending on what you use to render pages the syntax will vary on how you spew the value of the REQUEST object values into the form tag.
The REQUEST object holds variables that can be called from your pages. Query String variables end up living in the REQUEST object.
Some of the REQUEST objects variables are always there. For example there is the HTTP_USER_AGENT variable that when called will display the user's browser info. There is another called HTTP_X_FORWARDED_FOR, this variable holds the IP addresss of the user that is viewing the page. There are also a bundle of variables called URL, URL1, URL2 ...and so on. Now this is on my platform mind you.
What you need to do is find out the what your REQUEST object's variable names are, they vary depending on the platform you are using. If you are going straight .html pages I am not sure how to do this. In .asp I think you can call the REQUEST object's variables by doing something like REQUEST.variableName.value in vbscript
I am not sure what compiler you are using on your server machine. But I am sure that whatever books you have on the subject will have info about the REQUEST object's variable names. And of course you can always keep posting here for info.
Let me know how it goes.
The info in your REQUEST object is still your best bet as far as I can tell. Of course it does depend on what you are scripting in. Whichever tool you are using for logfile reporting is tapping into those REQUEST variables to track hits, IPs, referers and whatnot. So all the info is there for you to use you just need to find how to get ahold of those REQUEST object variables and dump the value of the current page into the action tag of your forms.
<SCRIPT type="text/javascript">
document.write ("<FORM method=\"post\" action=\" + self.location.href + "\">");
</SCRIPT>
<!-- put your form elements here -->
<INPUT type="submit" value="Submit to self">
</FORM>
;)