Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you reload an Included page within a page 1

Status
Not open for further replies.

riley3

Programmer
Apr 29, 2004
79
US
Hello,
I have a question regarding reload/refreshing an Included page using JS. There is a parent page with a form. Within that form on the parent page there is an Include page that displays db information when available. The db part works fine. However, when I refresh the parent page to reload the Included page I lose text box entries in the parent page. Can I reload/refresh the Include page using JS without losing the text box entries on the parent page?
Thank, Riley
 
It's an ASP (VBScript) page. The statement where the include is looks like this;

<!--#include file=parts.asp-->

The parent page is poADD1.asp and the included page is parts.asp inside a cell in the middle of the page. I may change the arrangement of the page so the parts can be selected first and then the vendor that we're buying the parts from can be entered lower down the page. That way when the page is refreshed to display the parts on order the vendor text box hasn't been entered yet. I don't much about frames, yet :).

Thanks for the help
Riley
 
I've been learining and testing IFrame's and I like it better than the include page routine for what I'm trying to do. I'm still not certain how to refresh the IFrame after it's populated from the database and still keep the text box entries on the parent page. Riley
 
Regarding reloading an included page in an ASP, go to the ASP forum and ask: forum333

Now, reloading an iframe should be as simple as (from the parent):

document.frames['myIframe'].location = sameLocation;

...where 'sameLocation' = the URL of currently loaded page.

Since only the contents of the iframe are being reloaded, you will not lose textbox entries on the parent page.

'hope that helps.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Would it be something like this? Where the poPARTinc.asp page is the included database routine page inside of the IFrame or should the location = be the parent page?

<script language="javascript">
function fRefresh () {
document.frames['partsIFrame'].location = poPARTinc.asp;
}</script>

And then I would have a button next to the IFrame that would have an onClick="fRefresh()" event and when I clicked the button the database results would appear in the IFrame?

 
If you are filling the iframe with just the contents of the ASP, then your only issue is that the URL needs to be in quotes.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
My actual code is correct (I think). I was using Notepad to type and forgot to add the quotes. Single quotes, right? Here is the code cut from the web page.

<script language="JavaScript">
function fRefresh() {
document.frames['partsIFrame'].location = 'poPARTinc.asp';
}
</script>

------------------------
<INPUT TYPE="button" onClick="fRefresh()" VALUE="Refresh">

(the button is just below the IFrame)
------------------------
<iframe
name="partsIFRAME"
id="partsIFRAME"
src="poPARTinc.asp"
height="100"
width="438"
frameborder="1"
scrolling="yes"
marginwidth="0"
marginheight="0" align="center">
</iframe>

------------------------------
Still doesn't work and refresh the contents of the IFrame. I'm sure there is a small piece missing. Thanks for all the help Dave.
Riley
 
You code looks fine. Are the ASP contents in the IFRAME when the page draws for the first time?

Debugging tips:

(1) Put alert statements in fRefresh() before AND after the location call. Make sure the function is being reached and control passes through the whole thing.

(2) Consider that the ASP might be so small, it might be refreshing quickly and, therefore, it doesn't look like it's refreshing at all.

(3) Put an alert message in the ASP when it draws to confirm (2), above.

(4) Try changing statement in function to point frame at ' to see if you can redirect the contents of the iframe.

(5) Make sure the code you posted here is the same as the code you're actually using! :)

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
The IFrame box is empty when the parent page loads. There is a click botton above the IFrame box that loads a parts selection page in a small window. This page/process lets me select a part and add it to a db table, the results being what I want to show up in the IFrame box. After adding the parts to the db I want to click the Refresh button below the IFrame box to get the results to show up in the IFrame box. I can click on the parent page and they show up just fine but then I lose any form entries that already been entered. I'll start doing some debugging right away. And yes the code is cut and pasted from the asp page. Riley
 
Now I'm getting confused - :). I put alerts on the parent page both in front of the location call and after so that when the Refresh button is clicked I should get two alerts. I only get the first one. Not the second.

However, what's interesting is when I put an alert on the src page that's called/used by the IFrame I get an alert as soon as the parent page is loaded. At this time the parts add button has not been click to even start the process... I just realized the IFrame tag may be preloading the src page from the IFrame. Is that so?
Riley
 
Can I reload/refresh the Include page using JS without losing the text box entries on the parent page?

Rather than an include, you could do a javascript HttpRequest to gather whatever info you need. You then repeat the HttpRequest on your event handler, to refresh the content.
 
Thanks Dave, I got it. Your programming and debugging suggestions helped solve the problem. The parent page and include page within the IFrame works just like I wanted them too. Can't believe I've ignored the IFrame tag for so long. Lazy I guess. Riley
 
'glad you got it working! Thanks for the star.

Happy New Year!

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
I am working with a similar issue.

I am working in ASP, and need to grab the index value from a combo box, then send it with a function to an iframe. But the value i pull, is always the same, even with an OnChange event it the combo box. It does not send a new value, only the first value in the query.

I have been tacking this for about a day now and tried using your steps.

Can you help me out?

Thanks in advance.
 
You're not getting the index of the combo box correctly.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
haha, i just figured it out, and ya, it was the index. It wasnt even pulling one. it was pulling a record id with the same number and would hold it. it works just fine now though.


thx

:)
 
Just out of curiousity... did you use the forum's search function to find this thread? ...or did you just happen to see it while purusing (sp?) the site?


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top