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

Probably [another] dumb question

P: n/a
I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I wish to modify
doesn't exist. IOW,

function editPage() {
history.go(-n);
/* modify the target page */
} /* return to the modified target page

How do I effect the changes to the page before exiting the script?

TIA,

--
Ed Jay (remove M to respond by email)
Dec 30 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ed Jay said the following on 12/30/2005 3:38 PM:
I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I wish to modify
doesn't exist. IOW,

function editPage() {
history.go(-n);
/* modify the target page */
} /* return to the modified target page

How do I effect the changes to the page before exiting the script?


Well, after you history.go you aren't on that page anymore so nothing
after that statement should be executed.

If you are wanting the reverse:

function editPage(){
/*modify the target page
return to the modified page */
history.go(-1)
}

Then that is damn near impossible. You can't edit a page that isn't loaded.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 31 '05 #2

P: n/a
Randy Webb <Hi************@aol.com> wrote:
Ed Jay said the following on 12/30/2005 3:38 PM:
I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I wish to modify
doesn't exist. IOW,

function editPage() {
history.go(-n);
/* modify the target page */
} /* return to the modified target page

How do I effect the changes to the page before exiting the script?


Well, after you history.go you aren't on that page anymore so nothing
after that statement should be executed.

If you are wanting the reverse:

function editPage(){
/*modify the target page
return to the modified page */
history.go(-1)
}

Then that is damn near impossible. You can't edit a page that isn't loaded.


I understand. I'm looking for a way to load a page from the cache and
modify it from within the script. The problem I have is that apparently
the page doesn't get loaded until I exit the script. I am/was looking for
a way around it.

The only thing I can think of is to modify the page when I submit the
form, so if I return to it I'm in the 'edit mode.'

The difference between normal and edit modes is that in the normal mode,
the form is submitted to the next page in order, whereas in the edit mode
the form is submitted to the final page. There are six pages of data entry
and a final report page. I want to return to individual pages in the edit
mode from the final page and return to the final page after editing so I
don't have to re-enter the data on subsequent pages.

I can, of course, mark a page to be in the edit mode when I submit it the
first time, but the guy entering data could conceivably realize he made an
error and use his browser's back button to return to correct the problem,
and then submit the corrected data only to find that he skipped over empty
pages to get to the final page.

Yes, I could provide instructions to not do it, but I'm trying to make my
app damned-fool proof.

--
Ed Jay (remove M to respond by email)
Dec 31 '05 #3

P: n/a
Ed Jay said the following on 12/30/2005 11:13 PM:
Randy Webb <Hi************@aol.com> wrote:

Ed Jay said the following on 12/30/2005 3:38 PM:
I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I wish to modify
doesn't exist. IOW,

function editPage() {
history.go(-n);
/* modify the target page */
} /* return to the modified target page

How do I effect the changes to the page before exiting the script?
Well, after you history.go you aren't on that page anymore so nothing
after that statement should be executed.

If you are wanting the reverse:

function editPage(){
/*modify the target page
return to the modified page */
history.go(-1)
}

Then that is damn near impossible. You can't edit a page that isn't loaded.

I understand. I'm looking for a way to load a page from the cache and
modify it from within the script. The problem I have is that apparently
the page doesn't get loaded until I exit the script. I am/was looking for
a way around it.


You can't as you have no access to the cache (if it even exists). You
could look into a Frame situation where one frame kept track of the
"state" of the application and the other Frame was the pages being loaded.

When each page of the form was loaded, check the stateFrame to see what
it is supposed to do and then modify the Submit button accordingly.

<snip>
Yes, I could provide instructions to not do it, but I'm trying to make my
app damned-fool proof.


Fool-proof on the web is impossible :)

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 31 '05 #4

P: n/a
Randy Webb <Hi************@aol.com> wrote:
Ed Jay said the following on 12/30/2005 11:13 PM:
Randy Webb <Hi************@aol.com> wrote:

Ed Jay said the following on 12/30/2005 3:38 PM:

I'm using history.go(-n) to return to a page for editing without
refreshing or reinitializing the page. I want to modify the page within
the script, but until I return to the page, the element I wish to modify
doesn't exist. IOW,

function editPage() {
history.go(-n);
/* modify the target page */
} /* return to the modified target page

How do I effect the changes to the page before exiting the script?

Well, after you history.go you aren't on that page anymore so nothing
after that statement should be executed.

If you are wanting the reverse:

function editPage(){
/*modify the target page
return to the modified page */
history.go(-1)
}

Then that is damn near impossible. You can't edit a page that isn't loaded.

I understand. I'm looking for a way to load a page from the cache and
modify it from within the script. The problem I have is that apparently
the page doesn't get loaded until I exit the script. I am/was looking for
a way around it.


You can't as you have no access to the cache (if it even exists). You
could look into a Frame situation where one frame kept track of the
"state" of the application and the other Frame was the pages being loaded.

When each page of the form was loaded, check the stateFrame to see what
it is supposed to do and then modify the Submit button accordingly.

<snip>
Yes, I could provide instructions to not do it, but I'm trying to make my
app damned-fool proof.


Fool-proof on the web is impossible :)

:-)

What I ended up doing was create a hidden input element and setting its
value after validating the form. On resubmitting the form after editing
the page, it tests the value. Iff it's true, it changes the submit URL to
point to the final page.

--
Ed Jay (remove M to respond by email)
Dec 31 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.