By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,835 Members | 1,024 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,835 IT Pros & Developers. It's quick & easy.

history.back() problem with firefox

P: n/a
Hi,

I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.

This problem is only with firefox. It works fine with IE. Can anyone
help me on this?

Feb 22 '07 #1
Share this Question
Share on Google+
7 Replies

P: n/a
On 22 Feb, 22:17, mohammed.nagh...@gmail.com wrote:
Hi,

I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.

This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
we'd love to help I am sure, but can only do so if you provide details
of the code and make sure you question makes a bit more sense!!
what are the two pages called, page2.jsp and page2.jsp and why do you
have 2 submit buttons on the page? and what does the other one do?

Feb 23 '07 #2

P: n/a
mo**************@gmail.com wrote:
Hi,

I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.

This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.

But without knowing where the typo is, it's practically impossible to
understand the question...

--cb
Feb 23 '07 #3

P: n/a
On Feb 23, 12:58 am, Christoph Burschka <christoph.bursc...@rwth-
aachen.dewrote:
mohammed.nagh...@gmail.com wrote:
Hi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?

I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.

But without knowing where the typo is, it's practically impossible to
understand the question...

--cb
OK. Let me explain again.

I have Page1.jsp with 2 buttons. One button is used to navigate to
Page2.jsp and is a submit button. It submits the values enterd in
page1 to page2. This is done since some of the fields are common in
both pages and we do not want the user to re-enter the values if he
has already done so in page1.

The second button is again a submit button. But this one submits the
values of the fields entered in Page1.jsp and writes into the
database.

Now I use button1 and go to Page2.jsp, And I come back to page1.jsp
using a link that does a history.back(). I do this becoz I dont want
to enter anything in page2.jsp. So I come back to page1 and try to
submit the page using button2. Now instead of submitting the page and
writing to the databse, button2 behaves like button1 nad takes me to
page2.jsp again.

And this problem is only with firefox.

Feb 26 '07 #4

P: n/a
On 26 Feb, 19:20, mohammed.nagh...@gmail.com wrote:
On Feb 23, 12:58 am, Christoph Burschka <christoph.bursc...@rwth-

aachen.dewrote:
mohammed.nagh...@gmail.com wrote:
Hi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.
But without knowing where the typo is, it's practically impossible to
understand the question...
--cb

OK. Let me explain again.

I have Page1.jsp with 2 buttons. One button is used to navigate to
Page2.jsp and is a submit button. It submits the values enterd in
page1 to page2. This is done since some of the fields are common in
both pages and we do not want the user to re-enter the values if he
has already done so in page1.

The second button is again a submit button. But this one submits the
values of the fields entered in Page1.jsp and writes into the
database.

Now I use button1 and go to Page2.jsp, And I come back to page1.jsp
using a link that does a history.back(). I do this becoz I dont want
to enter anything in page2.jsp. So I come back to page1 and try to
submit the page using button2. Now instead of submitting the page and
writing to the databse, button2 behaves like button1 nad takes me to
page2.jsp again.

And this problem is only with firefox.
I am assuming that you use javascript to changing the action of the
form in Page1.jsp to Page2.jsp when button1 is pressed, a change which
firefox preserves whereas IE "forgets".
Basically you want a single form with two buttons with different
names, one which said "submit this bit", and the other which is later
on that says "submit whole form" then the solution is to have both
buttons post back to Page1.jsp, if the submit button that was pressed
is button 1, then write out the form again (and add some js that jumps
them to the second section, and hey presto the user is back in the
page at the right place to carry on, if the second button is pressed
the great, let your server side logic show that. Having a dead page
isnt too good.
However if you do want to go that way have an onload statement that
initialises the form's action to whatever default you want it to be.
Personally I think having half a form submit is odd, if the data is
common to both things, then use a session to preserve state.

Feb 26 '07 #5

P: n/a
On Feb 26, 12:26 pm, "shimmyshack" <matt.fa...@gmail.comwrote:
On 26 Feb, 19:20, mohammed.nagh...@gmail.com wrote:


On Feb 23, 12:58 am, Christoph Burschka <christoph.bursc...@rwth-
aachen.dewrote:
mohammed.nagh...@gmail.com wrote:
Hi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.
But without knowing where the typo is, it's practically impossible to
understand the question...
--cb
OK. Let me explain again.
I have Page1.jsp with 2 buttons. One button is used to navigate to
Page2.jsp and is a submit button. It submits the values enterd in
page1 to page2. This is done since some of the fields are common in
both pages and we do not want the user to re-enter the values if he
has already done so in page1.
The second button is again a submit button. But this one submits the
values of the fields entered in Page1.jsp and writes into the
database.
Now I use button1 and go to Page2.jsp, And I come back to page1.jsp
using a link that does a history.back(). I do this becoz I dont want
to enter anything in page2.jsp. So I come back to page1 and try to
submit the page using button2. Now instead of submitting the page and
writing to the databse, button2 behaves like button1 nad takes me to
page2.jsp again.
And this problem is only with firefox.

I am assuming that you use javascript to changing the action of the
form in Page1.jsp to Page2.jsp when button1 is pressed, a change which
firefox preserves whereas IE "forgets".
Basically you want a single form with two buttons with different
names, one which said "submit this bit", and the other which is later
on that says "submit whole form" then the solution is to have both
buttons post back to Page1.jsp, if the submit button that was pressed
is button 1, then write out the form again (and add some js that jumps
them to the second section, and hey presto the user is back in the
page at the right place to carry on, if the second button is pressed
the great, let your server side logic show that. Having a dead page
isnt too good.
However if you do want to go that way have an onload statement that
initialises the form's action to whatever default you want it to be.
Personally I think having half a form submit is odd, if the data is
common to both things, then use a session to preserve state.- Hide quoted text -

- Show quoted text -
You are right. I am using javascript to change the action of the page
depending on which button is clicked.

I tried using the onload. This is how i used it

<body onload="setAction();">

and in setAction

function setAction()
{
document.formname.action = 'default action';
}

But it didnt work.

Is it the right way to use?

Feb 26 '07 #6

P: n/a
On 26 Feb, 21:57, mohammed.nagh...@gmail.com wrote:
On Feb 26, 12:26 pm, "shimmyshack" <matt.fa...@gmail.comwrote:
On 26 Feb, 19:20, mohammed.nagh...@gmail.com wrote:
On Feb 23, 12:58 am, Christoph Burschka <christoph.bursc...@rwth-
aachen.dewrote:
mohammed.nagh...@gmail.com wrote:
Hi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.
But without knowing where the typo is, it's practically impossible to
understand the question...
--cb
OK. Let me explain again.
I have Page1.jsp with 2 buttons. One button is used to navigate to
Page2.jsp and is a submit button. It submits the values enterd in
page1 to page2. This is done since some of the fields are common in
both pages and we do not want the user to re-enter the values if he
has already done so in page1.
The second button is again a submit button. But this one submits the
values of the fields entered in Page1.jsp and writes into the
database.
Now I use button1 and go to Page2.jsp, And I come back to page1.jsp
using a link that does a history.back(). I do this becoz I dont want
to enter anything in page2.jsp. So I come back to page1 and try to
submit the page using button2. Now instead of submitting the page and
writing to the databse, button2 behaves like button1 nad takes me to
page2.jsp again.
And this problem is only with firefox.
I am assuming that you use javascript to changing the action of the
form in Page1.jsp to Page2.jsp when button1 is pressed, a change which
firefox preserves whereas IE "forgets".
Basically you want a single form with two buttons with different
names, one which said "submit this bit", and the other which is later
on that says "submit whole form" then the solution is to have both
buttons post back to Page1.jsp, if the submit button that was pressed
is button 1, then write out the form again (and add some js that jumps
them to the second section, and hey presto the user is back in the
page at the right place to carry on, if the second button is pressed
the great, let your server side logic show that. Having a dead page
isnt too good.
However if you do want to go that way have an onload statement that
initialises the form's action to whatever default you want it to be.
Personally I think having half a form submit is odd, if the data is
common to both things, then use a session to preserve state.- Hide quoted text -
- Show quoted text -

You are right. I am using javascript to change the action of the page
depending on which button is clicked.

I tried using the onload. This is how i used it

<body onload="setAction();">

and in setAction

function setAction()
{
document.formname.action = 'default action';

}

But it didnt work.

Is it the right way to use?
well
document.getElementById('formID').action = 'Page1.jsp';
would work better, but you could also add a clause to the onsubmit of
the form, so that depending on which button is pressed it changes the
action to the required value.
Sorry I didnt say that before, thats the way I would probably do it,
given that I _had_ to do it this way :)

Feb 26 '07 #7

P: n/a
On Feb 26, 3:16 pm, "shimmyshack" <matt.fa...@gmail.comwrote:
On 26 Feb, 21:57, mohammed.nagh...@gmail.com wrote:


On Feb 26, 12:26 pm, "shimmyshack" <matt.fa...@gmail.comwrote:
On 26 Feb, 19:20, mohammed.nagh...@gmail.com wrote:
On Feb 23, 12:58 am, Christoph Burschka <christoph.bursc...@rwth-
aachen.dewrote:
mohammed.nagh...@gmail.com wrote:
Hi,
I have 2 submit buttons in a jsp page. One of them takes me to
page2.jsp and also passes the values enetered to page2.I have a link
in the page2 that does a history.back to come to the previous page to
make any chnages necessary. Now after making my changes, instead of
going to page2.jsp if I want to submit the page, Instead of submitting
the page it takes me to page2.jsp again.
This problem is only with firefox. It works fine with IE. Can anyone
help me on this?
I'll assume you made a typo and one of the pages mentioned is actually
called page1.jsp. Otherwise, this really doesn't make a lot of sense.
But without knowing where the typo is, it's practically impossible to
understand the question...
--cb
OK. Let me explain again.
I have Page1.jsp with 2 buttons. One button is used to navigate to
Page2.jsp and is a submit button. It submits the values enterd in
page1 to page2. This is done since some of the fields are common in
both pages and we do not want the user to re-enter the values if he
has already done so in page1.
The second button is again a submit button. But this one submits the
values of the fields entered in Page1.jsp and writes into the
database.
Now I use button1 and go to Page2.jsp, And I come back to page1.jsp
using a link that does a history.back(). I do this becoz I dont want
to enter anything in page2.jsp. So I come back to page1 and try to
submit the page using button2. Now instead of submitting the page and
writing to the databse, button2 behaves like button1 nad takes me to
page2.jsp again.
And this problem is only with firefox.
I am assuming that you use javascript to changing the action of the
form in Page1.jsp to Page2.jsp when button1 is pressed, a change which
firefox preserves whereas IE "forgets".
Basically you want a single form with two buttons with different
names, one which said "submit this bit", and the other which is later
on that says "submit whole form" then the solution is to have both
buttons post back to Page1.jsp, if the submit button that was pressed
is button 1, then write out the form again (and add some js that jumps
them to the second section, and hey presto the user is back in the
page at the right place to carry on, if the second button is pressed
the great, let your server side logic show that. Having a dead page
isnt too good.
However if you do want to go that way have an onload statement that
initialises the form's action to whatever default you want it to be.
Personally I think having half a form submit is odd, if the data is
common to both things, then use a session to preserve state.- Hide quoted text -
- Show quoted text -
You are right. I am using javascript to change the action of the page
depending on which button is clicked.
I tried using the onload. This is how i used it
<body onload="setAction();">
and in setAction
function setAction()
{
document.formname.action = 'default action';
}
But it didnt work.
Is it the right way to use?

well
document.getElementById('formID').action = 'Page1.jsp';
would work better, but you could also add a clause to the onsubmit of
the form, so that depending on which button is pressed it changes the
action to the required value.
Sorry I didnt say that before, thats the way I would probably do it,
given that I _had_ to do it this way :)- Hide quoted text -

- Show quoted text -
Thank you for the help provided. It works now with the above method. :)

Feb 27 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.