NetTalk Central

Author Topic: How to refresh another frame  (Read 4053 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
How to refresh another frame
« on: July 03, 2009, 04:57:29 AM »
Hi,
I need to refresh frame 3 evry time the page on frame 2 canges.
For ex,
I have a form in frame 2, I need to refresh frema 3 avery time the user press save or cancell in frame 2.
I call another browse in frame 2 by the menu (the menu is in frame 2), I need the frame 3 to be refreshed.

Any way to do this?
Thanks
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: How to refresh another frame
« Reply #1 on: July 03, 2009, 07:48:29 AM »
In HTML you can't do it. Other than by refreshing the whole frameset.

you might be able to do it from JavaScript though by adding some scripting to the page when the one side is refreshed.

If the "other" frame is dynamic, you may also be able to do it with javascript.

Cheers
Bruce

Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Re: How to refresh another frame
« Reply #2 on: July 08, 2009, 02:48:22 PM »
I'm trying to do something similar, and I have a partial solution.

In my app I open the browse in frame 1, and any form for that browse in frame 2.

My URL on Save and Cancel for the form is 'Blank'
In every post embed point I save it frame I want to refresh to a session value (ie. p_web.setSessionValue('loc:reloadFrame','Browse'))

In my 'Blank' page I have an XHTML embed with the condition: p_web.IfExistsSessionValue('loc:reloadFrame')
The XHTML I have:
<script> top.frames.<!-- Net:s:loc:reloadFrame -->.location.reload(true) </script>

And that 'should' refresh the frame.

Now for the problem... If the frame you're trying to refresh has done a post then your user will get a nice message asking them if they want to resend the post.  This is a particular problem if the last post was a delete, as the browser will try and delete the same record again.

I've put this problem on the back burner for now, and I just use the auto refresh on all my browses.  If anyone can build on this it would be a great help though.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11193
    • View Profile
Re: How to refresh another frame
« Reply #3 on: July 08, 2009, 09:47:16 PM »
It does kinda suggest that you probably shouldn't be using Frames in the first place.
Perhaps your site should be built without frames?

Cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to refresh another frame
« Reply #4 on: July 11, 2009, 08:02:43 AM »
Hi,
I found the following code:

parent.frames['yourFrameName'].location.reload();

using it in the Menu Item, "on click" field, it works ok refreshing another frame, now two questions:

1- How and where in the code must I use this code in a form to refresh another frame on page load?, may be it cant be done, then...
2- Is there any chance to add on-click to the browse change and other buttons?

Thanks Alberto
-----------
Regards
Alberto

Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Re: How to refresh another frame
« Reply #5 on: July 29, 2009, 02:55:03 PM »
It does kinda suggest that you probably shouldn't be using Frames in the first place.
Perhaps your site should be built without frames?

Cheers
Bruce


I'm open to suggestions on other was to get the results I want.

I want the user to be able to open a browse on the left if the page.  When they change or insert a record I want the form to show up to the right of the browse.  This first form may have a browse as an element, in which case if they insert or change a record in that new browse I want a 2nd for to open up to the right of the first form.  When a user ether submits or cancels a form I want it to go away until they open another, and ideally update the browse it was opened from.

Example 5 looks like it may be at least close to what I want, but last I checked it's not quite working right.
Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Matthew51

  • Full Member
  • ***
  • Posts: 151
    • View Profile
    • Email
Re: How to refresh another frame
« Reply #6 on: July 29, 2009, 03:13:10 PM »
Hi,
I found the following code:

parent.frames['yourFrameName'].location.reload();

using it in the Menu Item, "on click" field, it works ok refreshing another frame, now two questions:

1- How and where in the code must I use this code in a form to refresh another frame on page load?, may be it cant be done, then...
2- Is there any chance to add on-click to the browse change and other buttons?

Thanks Alberto

Lets say when you open 'Page1' you want to refresh 'frameB'. 

1. Go to the XHtml tab on the NetWeb setting for 'Page1'. 
2. Click insert.
3. Select 'Routine' under 'Embed:'.
3. Give your routine a name ('ReloadFrameB' for example)
4. Leave the condition blank
5. Select a location that will place it inside the <body> tag.  For a form or browse any point should work as the template wraps them in a body tag for you.  For a NetWebPage 'after <body>' will work best.
6. Under 'XHTML" put '<scrip>parent.frames.frameB.location.reload();</script>

If you always want to reload 'frameB' when 'Page1' loads then you're done.  If you want it to refresh the frame sometimes, or different frames at times then you're going to have to work some magic with stored values and NetTalk tags.

Contractor with 10+ years of NetTalk experience looking for work.
www.linkedin.com/in/matthew-leavitt
BisWare.ca
Check out my free EasyTime Template

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: How to refresh another frame
« Reply #7 on: July 30, 2009, 05:32:43 PM »
Thanks Matthew!!!
It works ok!
Alberto
-----------
Regards
Alberto