OnClick for a view opened in popup window

Hi,
This should be an easy one for all the experts here. Here goes: I have a popup window that shows a view. It is opened from an onFocus event in another form with codes:
window.open("/DBname.nsf/Test?OpenView");blur()

How and where do I make it such that if I click(single-click) a document in the view, it will send the document's column values back to the fields in the form where this view was opened from? Thanks in advance


DominoNotes Beginner
lianaizhouzhiruoAsked:
Who is Participating?
 
Sjef BosmanConnect With a Mentor Groupware ConsultantCommented:
I'm terribly afraid that there's only one thing you can do:
- write your WebQueryOpen agent in script, which ...
- opens the view,
- reads all the lines using columnvalues(), and
- creates the webcontent you want.
0
 
Sjef BosmanGroupware ConsultantCommented:
What do you mean "send the document's column values back"? Do you want to open the document, or anything else?

Assumption: you want to click a line in the view and copy some values to the existing other window. That's not too difficult, you can do that using JavaScript. Add an HTML column, or add some HTML around one of the column values, that creates a link to a JavaScript function, like

    <A ONCLICK="copyvalues(col1,col2,col3,...);">...</A>

and then fill in for the col# values the corresponding column values. The copyvalues function should find the correct target window, and copy the values to the right fields. It could be defined like

    function copyvalues(col1,col2,col3,etc) {
        window.frames['targetframe'].elements['fieldname'].value= col1
        etc...
    }
0
 
lianaizhouzhiruoAuthor Commented:
Hi bosman, I meant send column values of the selected document to another form's field(the form where the view window was opened from)

Regarding your suggestion, I created a new column in my current view and put it as 1st column then i added the following code in the column formula: "<A ONCLICK=\"copyvalues(Code);\"></A>" where Code is a column name of the view which I want to copy to the other form. However, I have no idea where to put the copyvalues function so I put them in the JS Header and onClick event of the form where the view window was opened from. The codes in my function is:
function copyvalues(Code) {
        window.frames[0].elements[whatCode].value= Code;
        window.frames[0].elements[whatCode].text= Code;
}
The entire thing doesnt seem to work though. When I click a line in the view nothing happens.

I think I'm probably doing something wrong, please enlighten thanks!



Domino/Notes Beginner
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
Sjef BosmanGroupware ConsultantCommented:
New column created: OK
Code should be:
      "["<A ONCLICK=\"copyvalues(\"" + @Implode(value1:value2:value3:etc; "\",\"") +"\");\">copy</A>]"
   the [ and ] are required to force passthru-HTML in a view column, the wordt copy will be shown as Link
copyvalues in JS-Header: OK
onClick-event: has got nothing to do with this...
copyvalues:
     function copyvalues(val1, val2, val3, etc) {
             window.frames[0].elements[field1].value= val1;
             ...etc
     }
0
 
lianaizhouzhiruoAuthor Commented:
Hi Bosman,

I tried what you posted but the codes have an "operator or semicolon expected" error. I changed it to :
"[<A HREF='javascript:void(0);' ONCLICK=\"copyvalues('" + @Implode(@Text(TCode):Description;"','") +"');\">copy</A>]"
and theres no error now. However, nothing happens when i click the document in the view. Therefore, I created a ViewTemplate for the view(with an embedded view) and now it works fine. I also changed the function codes to :
window.opener.document.forms[0].whatTCode.value = Tcode;
window.opener.document.forms[0].description.value = desc;
because frames[0].elements[field].value doesnt seem to work and gives me an error.

Anyway, now I've managed to get all this opening, clicking and sending values back to main window working. There is just one problem now though. When I use the viewtemplate, it seems that the displayed lines are limited to 9999(which seems to be the max for an embedded view). Is there any workaround for this?
0
 
Sjef BosmanGroupware ConsultantCommented:
So the other question helped you a little? Great!

I'm not quite sure if it's the right document, but read "To set line counts in embedded views" in de Domino Designer help db. It says:
- there's an info tab on the embedded view, it contains the number of lines to display; what happens if you set it to 0?
- you can add the &Count=n argument to the URL; what happens if you add &Count=99999
- there is a server-wide default, see the Internet Site document for your server; read "Specifying the number of lines to display in a view" in the Domino Administrator help db
0
 
lianaizhouzhiruoAuthor Commented:
Hi Bosman,

1    Changing the display to 0 in embedded view property limits the lines to 30 whcih i believe is a server default.
2.   Adding &Count=99999 to the end of the URL string increases the limit to 1000 but it does not go any higher no matter what i change the number to.
3.   I dont know where I can change this server administrator thing you mentioned and I probably wont be allowed access to it anyway.
0
 
lianaizhouzhiruoAuthor Commented:
Hi Bosman,

I'll try writing a script to do what you said. Will get back to you on that. Anyway, is it possible to change the default $$ViewTemplate form, rather than creating a new "$$ViewTemplate for <form>" form.



DominoNotes Beginner
0
 
Sjef BosmanGroupware ConsultantCommented:
There is no default $$ViewTemplate form, but you can create your own default form that will be used for all views opened on the web. That form should be called $$ViewTemplateDefault. Small drawback: you have to provide your own buttons.
0
 
lianaizhouzhiruoAuthor Commented:
Sorry have been busy with other stuffs. Wont be following up on this question anymore so i'm just gonna accept your answer about writing a webqueryopen agent to close this question
0
All Courses

From novice to tech pro — start learning today.