Link to home
Start Free TrialLog in
Avatar of bobdraz
bobdraz

asked on

Change embedded view element on a web page.

I currently have a web page with an embedded view element. When the page opens in a frameset the proper view is displayed fine on the page. I'd like to use some kind of hotspot that would trigger a hide-when formula so I could choose to see a different view element on the same web page. I do want the current view element to be the one the page opens with, but I'd like to present a choice within the page to select another view. Is there a way?
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Use $$WebTemplateDefault to show your view, it is a form that serves as a wrapper around every view. Don't open the form then, open de view instead.
Avatar of p_partha
p_partha

is it webtemplatedefault or $$viewtemplatedefault

Partha
for your requirement,lets assume you have the dropdowns of viewnames


on change of the dropdown just give this: (assuming yoru drop down field name to be sMake)
      frm = document.forms[0];
      kwd = frm.sMake.options[frm.sMake.selectedIndex].text;



location.href=location.href.split(".nsf")[0] + ".nsf/" + kwd + "?openview"

Now since you have a $$viewtemplatedefault, it will open any view with that page


HTH
Partha
Too fast... $$ViewTemplateDefault... Thanks, Partha
Bro,

Webtemplatedefault hmmm,i liked the name, probably we can have it for all documents which don't have a associated form to open in web :)

Partha
Avatar of bobdraz

ASKER

What can I use on the page to trigger a change in the value of $$ViewTemplateDefault? There is no drop down. There are only 2 views I want to associate with the page. The one it opens with and the one I want to change on the same page. Is there something like a button I can put on the page to click on to change the value of $$ViewTemplateDefault?
see ., there is nothign like changing viewtemplatedefault, What u have to do is in the button , just call this:

location.href=location.href.split(".nsf")[0] + ".nsf/" + "<your view name>"+ "?openview"


change the yourviewname to ur real view name

Partha
Can you explain why you want to do that.. when you can switch view using sidebar ? What is so special about that page which needs to switch views any other content reside in this page ?

~Hemanth
Avatar of bobdraz

ASKER

I didn't think buttons were allowed on a page. I'll try to added a button hotspot on the page. Also, will the above solution work within the embedded view element? I don't want the view to take up the entire frame, just within the embedded view element.
Bob, you're thinking "showing a page", we're thinking "showing a view, which is automatically wrapped in a standard layout".
1. Create a field to keep which view will be displayed on the page.

2. Create a computed subform. On each subform, embed each view you would like to displayed on the page.In subform formula, change subform name according value from above field

3. Create each subfrom and embed view in it

Sherry


Probably, this is the simples way to do it.

1 Create a Page and field "ViewName"
2. Embed View on page, check "Choose view based on formula". Then add formula according to value of field "ViewName"
3. For hopspot( or dropdownlist),when clicked, change the field "ViewName" value according to user choice.


It's very simple way to do  it. have fun with it

Sherry
Avatar of bobdraz

ASKER

I'm sorry if I confused you. The page in question has a lot of  links on the page and  alot of usefull information. There is one embedded view element on the bottom that opens with the correct view. Leaving the page right where it is, my client has requested if I can put a button on that page that will change the view in the embedded view element. Basically, he wants the page left as is, with the ability to choose a second view to be displayed within the embedded view element if he chooses to do so.

I don't want to fill the frame with the new view, just click a button on the current page and change the current value of the embedded view element.

Thanks
Avatar of bobdraz

ASKER

I'm not sure if I specified this is for the Web. Not the Notes client. When I referred to my client I met my customer.
You can use a tabbed table.

1. Create a table in a form, with as many rows as the number of views you want to display
2. Select Table / Table Rows / Special table row display / Show only one row at a time
3. Select Table / Table Rows / Which row to display / Users pick row via tab buttons
4. Embed each view in a different row and set a Tab label and caption For selected row
5. Decorate the table
6. Test it

Well, I'm very slow at composing a post... :(

What you need is a DHTML layer where you can change its contents, i.e. the page it's loaded in, without reloading  a whole new page.
Easiest way to do this ...

place the embedded view 1 and view in browser , copy entier applet with param tags and paste it into the form/page
similarly do it for second one.. (THis is because R5 doesn't allow multiple embedded views in one page, R6 does)

Place first and second view parameters in a div tag with id

eg: <DIV ID="view1"> <APPLET>...</APPLET> </DIV>

Now create this js function in the jsheader
function switchView() {

if(view1.style.visibility == "visible") {
view2.style.visibility = "visible";
view1.style.visibility = "hidden";
} else {
view1.style.visibility = "visible";
view2.style.visibility = "hidden";
}

}

Call this onload event and in the button



So, you should replace the space where now appears your embedded view with such a layer. Then set the layer source in the onLoad event of the page such that the first view is loaded when the page is loaded. Then put two buttons near the layer, such that each changes the source of the layer to the view currently not shown.
You might see some jump due to positioning if you don't use absolute positioning.. By default it is relative positioning

so your div tag should look like

<BR>
<DIV Style="position:absolute" ID="view1">
THis is <BR>
View area 1 <BR>
</DIV>
<DIV Style="position:absolute" ID="view2">
THis is <BR>
View area 2 <BR>
</DIV>
Avatar of bobdraz

ASKER

I do understand what you're proposing. In a form I have done that with no problem. On the Web in a Domino Page I seem to be limited.  

I don't mean to be difficult, but my customer wants the Page (not a form) left where it is and just change the embedded view.

I guess what I want to accomplish is a programmable tabbed table on a Page for the web.  Since  you can't create a field on a page, I had no way to change the tabbed value in the $tablenamefield.

Thanks
my soln is meant to work on the web
bobdraz
Notes tabbed tables work the same in a NotesPage or a NotesForm. Tab captions are automatically rendered as links to change the displayed row.
You need layers (HemanthaKumar's approach or mine) only if you don't want a complete page reload, else a tabbed table works fine.
I must say bobdraz has a problem of plenty ;-) Oh well! Sometimes easy solutions don't come to mind. Any ideas, why?

What is wrong is having a frameset inside the frameset? Why juggle betweeen subforms/selection formulas/extra fields and view templates.

I would go for a frameset embedded within frameset. In the innner frameset there would be two frames, one (top frame) will hold the listbox/hotspots/buttons/any other means of letting the user choose the view and in the second (bottom frame) will hold the view to display.

The URL generation can be done with Partha's logic given above. Just replace the location of the bottom frame with a new URL.
ASKER CERTIFIED SOLUTION
Avatar of p_partha
p_partha

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial