I have a table where i want the users to be able to edit
cells by clicking on them. Then they get the usual edit view
and after the changes are saved, they are redirected back
to the table view.
I use this in my template:
<td onclick="window.location='/patient/edit/{{patient.id}}/'">
It works for Firefox but unfortunately we use Explorer here
and Explorer doesn't work.
In the edit view i have a system where i keep track of the
referrer so i can redirect the user back to the correct page:
page = request.META["HTTP_REFERER"]
history[1] = history[0]
history[0] = page
This is what goes wrong in explorer: the HTTP_REFERER isn't set.
With Firefox, the HTTP_REFERER is set.
I tried to solve it by using a javascript function in the template
that explicitly sets the document.referrer.
The td code then looks like this:
onclick="edit({{patient.id}})">
The javascript function:
{% block extrahead %}
<script type="text/javascript">
// Only script specific to this form goes here.
// General-purpose routines are in a separate file.
function edit(id) {
document.referrer=window.location;
window.location='/patient/edit/id/'
};
</script>
{% endblock %}
Unfortunately, this doesn't work for both Firefox and Explorer.
In Firefox the clicking doesn't work, in Explorer, the click doesn't work
and gives an error. (runtime error on the
document.referrer=window.location; line)
Any idea how i can solve this?
Thanks,
Benedict
I had this problem with a client that was running Norton and
somewhere in the program preferences there's an option to disable the
browser referer. This is not exactly the name of the option, you'll
have to search for it. Maybe there's some application blocking,
specially if there's one installed that has privacy settings.
--
Julio Nobrega - http://www.inerciasensorial.com.br
I still find it strange that only Explorer is affected and that Firefox
handles everything ok.
Anyway, i'll try and implement it as a parameter.
Thanks for the info,
Benedict