How to combine the usefullness of @functions into iFrames

I am trying to build a search function that looks pretty on the web. I’ve got a perfectly fine searching set up, but now need to load into a specific area on the page and am trying to do it with iFrame. Here is my code:

@URLOpen(“http://ServerName/” + DbName + “.nsf/Categorised?SearchView&Query=”+SearchQuery)

…which works fine, but @SetTargetFrame doesn’t work to specify where the resultant search view is shown. Someone suggested usinf javascript to do it:

document.frames(‘iFrameName’).location.href=

…but I can’t figure out how to wedge it into my existing code.

Any thoughts?

Subject: How to combine the usefullness of @functions into iFrames…

Hi there,

are you using a hotspot button with the @URLopen code in it? If so, in the coding pane at the bottom, change the box on the left which says “Client” to “Web”, and you can put your Javascript in there. From your code, the javascript would be something like :

srchurl = “http://ServerName/” + document.forms[0].DbName.value + “.nsf/Categorised?SearchView&Query=”+document.forms[0].SearchQuery.value;

document.frames(‘iFrameName’).location.href=srchurl;

But I’m not a javascript bod very often, so that’s my best shot!

Hope that helps a bit though,

Craig.

Subject: RE: How to combine the usefullness of @functions into iFrames…

Yes!

Thanks for your post. After some tweaking, I got it working the way I want it to. Here’s the final code for the query:

DbName=“db1”;

alert("db name: "+document.forms[0].dbName.value);

srchurl = “http://192.168.0.2/“+DbName+”.nsf/Categorised?SearchView&Query=”+document.forms[0].SearchQuery.value;

document.frames(‘SearchViewArea’).location.href=srchurl;

This gets the results into the iFrame that I wanted to get it into. The next prob is finding the DbName like I used to be able to from @function. I have hard-coded the DbName that I want to search as I can’t quite get it to find it from my drop-down list of databases to search. I have a field called dbName that has a long list of dbs in it. So I’d like to get that field when the user chooses it and then hits the search button. Can’t quite get it though just yet.

Thanks for putting me on the right track though! I am not an avid user of Jscript, so just muddling along.

Any advice would be great!

Subject: RE: How to combine the usefullness of @functions into iFrames…

There are a couple of gotcha’s when it comes to drop down fields.

Firstly, unless you use keyword synonyms in the field domino doesn’t put value=“XXX” in the HTML option tag. So rather than saying

It says :

When you try and get the value with javascript in IE, it doesn’t exist so nothing is returned. To get round it, use keyword synonyms in the drop down box. i.e.

Value1|Value1

Value2|Value2

Value2|Value3

Although it seems to work now, IE didn’t used to like selecting from drop down lists either, so you might need to use this code to get the value, rather than field.value…

op = document.forms[0].Field.selectedIndex;

db = document.forms[0].Field.options[op].value);

Anyway, give it a go, and see if it makes any difference. Let us know how it goes,

Craig.

Subject: RE: How to combine the usefullness of @functions into iFrames…

Yeah, got this one the other day. I now use:

DbName=document.forms[0].DBFieldName.options[document.forms[0].DBFieldName.selectedIndex].text;

and that works fine now. That part was really confusing as, like you say, the value doesn’t seem to exist even though I can see the changed ‘value’. All looks good now.

Thanks a lot for the help.