Embedded view javascript

Hi!

I have a website where I want to click on a link and open a pop-up window. In this window there are an embedded view with clickable documents.

I want, when you click on a document, close the pop-up window and paste information on a text field on the first page.

Is this possible?

Best regards

Henrik

Subject: Embedded view javascript

Yes it is.

Now, if I was the really naughty type I could finish my response there since I did answer your question.

But I am not that naughty, and I will give you a bit more.

JavaScript can get the ‘parent’ of the pop-up window by referencing window.opener.

So, just before you close the pop-up, use window.opener to populate the text field.

Subject: RE: Embedded view javascript

Kenneth,Thanks for your answer!

That seems to work just fine. But how do I write the code in the view? When I click on a document, the document open. I don´t want that to happen. I want to call the javascript.

Best regards

Henrik

Subject: RE: Embedded view javascript

You need then to change the view column where you want those links.

To begin with, get rid of the auto-generated Domino links.

You do that by:

  1. Go to the column properties for the columns, go to the last tab, check the ‘Show values in this column as links’, save and close the view.

  2. Re-open the view, this time you un-check that checkbox, save and close.

If you test your view in a web browser now, there should be no links at all.

Now you need to create your own link in the column.

In the column formula, enter something like:

“[” + “<a href="javascript:myFunction('” + whatever argument(s) you want + “')">” + Your text + “” + “]”

Create the JavaScript function somewhere on your form/page.

If it is really short, you won’t even need a function, you can just call the JS code directly in the a-tag, separated by semi-colon of course.

Hope this helps

Ken, http://www.noteshound.com

Subject: RE: Embedded view javascript

Thank you Kenneth!

You made my day!

Best regards

Henrik

Subject: RE: Embedded view javascript

I new problem just occured.

Here is my formula for the link in the view:

“[” + “<a href="javascript:myFunction('” + Model + “', '” + ProductGroup + “', '” + ProductSubGroup + “', '” + Brand + “', '” + Factory + “')">” + Model + “” + “]”

My problem is that sometimes Model contains the character " and a comma. Like this:

Mac 325-16", 36cc none AV

Can I make HTML to understand this?

Best regards

Henrik

Subject: RE: Embedded view javascript

Actually, that’s quite easy.You’ll need to use the build-in JavaScript ‘escape’ function.

“[” + “<a href="javascript:myFunction(escape('” + Model + “‘), escape’” + ProductGroup + “‘), escape(’” + ProductSubGroup + “‘), escape(’” + Brand + “‘), escape(’” + Factory + “'))">” + Model + “” + “]”

In the function, you must unescape the parameters before you use them.

function myFunction(p1, p2, p3, p4, p5) {

var txtModel = unescape(p1);

etc., etc.

}

Subject: Embedded view javascript

I new problem just occured.

Here is my formula for the link in the view:

“[” + “<a href="javascript:myFunction('” + Model + “', '” + ProductGroup + “', '” + ProductSubGroup + “', '” + Brand + “', '” + Factory + “')">” + Model + “” + “]”

My problem is that sometimes Model contains the character " and a comma. Like this:

Mac 325-16", 36cc none AV

Can I make HTML to understand this?

Best regards

Henrik