Selectively run form 'onLoad' event?

Hi all

Having a bit of a problem designing a web site using Domino. I’m using Framsesets to achieve the required result for the ‘project owners’.

I start with a frameset1, which has 2 frames , ‘top’ and ‘bottom’. The top frame contains a ‘header’ form which remains constant for the entire site. It has a navigator which launches different parts of the site.

The bottom frame is the target for links in the top frame. When one of the navigators is ‘clicked’ it launches another frameset (with 2 frames, ‘nav’ and ‘view’) in the bottom frame.

The hotspot / URL for launching the ‘section’ is

DB := @ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName; -1);" “;”+“);”\“;”/");

“/” +DB + “/webWorking?OpenFrameset&Frame=nav&Src=(webAboutNav)?openForm”

The form ‘(webAboutNav)’ has an embedded view and an ‘URL’ field. The ‘URL’ field contains the URL to get the correct document to open in the ‘view’ frame. I open the document in the frame by using the ‘onLoad’ event of the form i.e.

parent.view.location.assign(document.forms[0].splashPageURL.value)

This all works great. However, my problem occurs because now we want the embedded view in the ‘nav’ frame to allow for different levels i.e. it is to be categorised. After the initial load, when you click on a document in the view, it opens in the ‘view’ frame perfectly. However, with the categorised view, if you expand or close another category, it causes the ‘onLoad’ event to execute and it causes the initial page to load in the ‘view’ frame.

I need to stop this from occuring. If the user expands a view, the contents of the ‘view’ frame need to remain where they were. So the question -

is there a way to stop the ‘onLoad’ running again? - i need it only to run when the initial navigator link in the ‘top’ frame is ‘clicked’.

I have tried using an extended URL to populate both frames from when the navigator is selected e.g. …“/webWorkingFS?OpenFrameset&Frame=nav&Src=(webBAboutNav)?openForm&Frame=view&Src=”+URL - but i find only the second half of the URL is acted upon. I have tried loading the document in the ‘view’ frame and getting it to call the contents of the ‘nav’ frame, but this requires the document to be in edit mode, which i definitely don’t want.

I tried using if statements in the ‘onLoad’ event, but it runs regardless. I think i need some sort of global reference for the ‘onLoad’ event to check.

e.g. if not (frameLoaded) {parent.view.location.assign(document.forms[0].splashPageURL.value)}

where frameLoaded is some how set from the initial URL/link in the top frame.

I’ve checked the notes forums and help files, but nothing seems to jump out at me, so any help / suggestions would be greatly appreciated.

TIA

andyG

Subject: Selectively run form ‘onLoad’ event ???

How about this?When you click on a link in the top frame, set a JavaScript variable in that frame.

When the onLoad event fires in the bottom frame, check the variable in the top frame. You can easily check contents in other frames with JavaScript.

If the variable is set, perform your actions and un-set the variable.

Next time the onLoad event fires, the variable should be un-set and nothing should happen.

Subject: RE: Selectively run form ‘onLoad’ event ???

Hi Ken

I was hoping this would be the case, but my javascripting skills are … shall we say … limited.

Could you post a code example of how to set a variable and then read it from another frame? or point me to a web resource / notes net posting ?

In the mean time, i’m checking if i can use @UrlQueryString somehow to detect what is going on.

thanks for the response

andyG

Subject: My (dodgy) solution

Hi

I know some sort of javascript would have been a better solution, would probably answer future problems for me, but for the moment here is my solution:

In the form with the embedded view, i have a field called ‘formLoaded’. It is a computed field with the formula :

@If( @Contains( @UrlQueryString; “Expand”:“Collapse” ) ; 1; 0 )

The onLoad event for the form has the following javascript:

if (document.forms[0].formLoaded.value == “0” ) {

parent.NotesView.location.assign(document.forms[0].splashPageURL.value)

}

I used this solution because i noticed that a computed field with a “@UrlQueryString” would show the target frame when the form first loaded. Any manipulation of the embedded view after that moment would display other details relating to the embedded view e.g. start=1;count=30;Expand=1; etc.

So possibly not the best solution, but it seems to work.

hope this may help some one else … until i come up with a (more) elegant solution.

cheers

andyG