Solved

Embedded view on Web popup window

Posted on 2004-09-15
37
380 Views
Last Modified: 2013-12-18
Hi guys

Just a question of intrest.  Is it possible to create a Embedded view on a popup window for the web and enable a user to select a document and pass the value one requests to the main form.
Right now, I have it done by displaying the vlaues in a Dialog List and returing the values using JS.
But the "problem ,which is more of not so friendly" or issue is that, the choices in the Dialog List becomes too many and it is a bit of a hassel for users to scroll through all the options.
With a embedded view,which is categorised this will make the users life easier.

Regards
0
Comment
Question by:Rohith_Thomas
  • 19
  • 14
  • 3
  • +1
37 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
It is certainly possible, if only you start the window using JavaScript with the right URL, i.e. the URL of a page or form with an embedded view. You'd have to use JavaScript to move values to the parent window. You want to know how?

Look into window.open with all its parameters.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi ,

I can open the window with the embedded view, but can seem to pass value with JS.
I could pass the vlaues from a text field on the popup window, but how do I pass certain values on the document I select from the embedded view?

Please help
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
You need to have a link on every line of the view, calling a JavaScript function that will copy some values and activate the parent window somehow. See also
    http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_21125803.html
0
 
LVL 19

Expert Comment

by:RanjeetRain
Comment Utility
THere are a couple of ways to get to the window that opened the child window.

You may use window.parent or window.opener to get to the parent window. I also see some people use base object, however I am not very sure about its usage.

0
 

Author Comment

by:Rohith_Thomas
Comment Utility
"["<A ONCLICK=\"copyvalues(\"" + @Implode(Objective:Level;"\",\"") +"\");\">copy</A>]"

Hi I am getting an error on this piece of code on the 1st column.  It say "Operator , semicolon expected" with the ONCLICK highlighted in red!!!! No idea why.

Am i correct in saying that the function for copyvalues would be in the JS header of the original form?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
   "["<A ONCLICK=\"copyvalues(\"" + @Implode(Objective:Level;"\",\"") +"\");\">copy</A>]"

The line contains too many double-quotes, try this one:

    "[<A ONCLICK=\"copyvalues('" + @Implode(Objective:Level;"','") +"');\">copy</A>]"

I replaced some of the double-quotes with single quotes, otherwise you'd have to add a lot of backslashes...

The copyvalues-function indeed should be placed in the JSHeader.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi
Thanks for that.

I have palced the function in the JS Header as follows and the fields on the form are editable text fields.

function copyvalues(Objective, Level) {
window.frames[0].elements[Objective].value= Objective;
window.frames[0].elements[Level].value= Level;
}

After opening the view from a button using
window.open("/Rohith/BalScoreR4.nsf/PicklistObjective?OpenView");blur()

and selecting on a document , nothing happens.

How does the values get transfered back. I tried to click on the document but it opens the document within the view, which also I dont want the user to be able to do

regards
0
 
LVL 2

Expert Comment

by:kalios
Comment Utility
if you do not want to open that document in the view when the user clicks it you have do the following:

go to each column properties in the view and make sure that the last tab has this option unchecked:
show values in this column as links.

uncheck this for all columns in the view and the user cannot click to open..

kalios
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi Kailos

The "Show value in this column as link" is unchecked for all the columns. But I can still open the document from within the popup window.

regards
0
 
LVL 2

Expert Comment

by:kalios
Comment Utility
that should not happen. do one thing....

What is the form you are using in your select for that view..

In designer right click the form and click on Design Properties and go to the 3rd tab and click on
hide design element from web browsers.

so if any one clicks the form then the page will not be displayed.
0
 
LVL 2

Expert Comment

by:kalios
Comment Utility
i mean if anyone clicks the document then the form associated will not be displayed.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

I cant do that as well, cause firstly it would return an error page on the popup window.
Secondly, I need to open that form seperatley in the db.

Basically I am simulating this on the web where picklist objective is the form, which can be completed both on the web and client.
varDoc := @PickList( [Custom] : [Single] ; ""; "PicklistObjective" ; "Select the Objective" ;"Please select the required objective from the list below" ; 1);
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi sjef

I have tried to place the function in the Onclick out of desperation, but to no avail.  

Please advice on why the values are not being returned to the main window.

regards
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
The window.open has a lot of parameters. I cannot explain it better than lots of other people already did, see
    http://www.google.com/search?q=kees+kooten+esperanto+boek&hl=en&lr=&ie=UTF-8&start=10&sa=N

If the data doesn't arrive in the other form, please add some alert-statements, like
    alert(window.frames[0].name)
to see if you got the right window. Etc.

I'm off now, 20:41 here...
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

Thanks for the link, but unfortunately they are in german(i think)!!! Sorry.

I have tried to put in alerts in both the JS Header within the function and in the Window.open(which i dont know if its right) but nuthing still.

I dont have a problem with the window.open, as it opens the specified view.

Regards
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
See, it was too late to be answering questions. Totally wrong link, I must have done something in between... Sorry (it's Dutch by the way).

The links I meant are here:
    http://www.google.com/search?hl=en&ie=ISO-8859-1&q=window+open+javascript
I think the 4th one will help you most.

I assumed you have a problem with opening an additional window, but that seems not to be the case. Could you post the code in the JSHeader and in the view column (again)? Is the app visible via the web so I can have a peek what's under the hood?

Ah, blast, I think I know. There has to be a HREF in an <A> otherwise it wont work. Try the following:
    "[<A HREF="javascript:void(0);" ONCLICK=\"copyvalues('" + @Implode(Objective:Level;"','") +"');\">copy</A>]"
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi there

Here is the code in my view first column (view has about 8 or 9 columns, but only want to return 2)
 "[<A HREF="javascript:void(0);" ONCLICK=\"copyvalues('" + @Implode(Objective:Level;"','") +"');\">copy</A>]"
I get a error here saying "operator or semi-colon missing"

Code on JS in the form that calls the popup window.
function copyvalues(Objective, Level) {
window.frames[0].elements[Objective].value= Objective;
window.frames[0].elements[Level].value= Level;
}

Code on the button that calls the view
window.open("/Rohith/BalScoreR4.nsf/PicklistObjective?OpenView");blur()

I can send elements of the app to your personal email if necessary.

The other problem I have is, once the popup window opens with the specified view, if a user double clicks on a document, it opens that document within the popup window(dont know if you understand what I am saying here) which should not happen. If the user clicks on the document, the values should be passed back to the main form.

Regards

P.S
Thank you so much for all you help so far.  I am sort of a new commer to Web development and so far managed to do most of my work with lots of help for the experts on here.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
What I said wasn't true, the onclick works but you see nothing. Now you should see a proper link. There's another error in the line I gave you (sorry :-$ ), you need different quotes or more backslashes:
    "[<A HREF='javascript:void(0);' ONCLICK=\"copyvalues('" + @Implode(Objective:Level;"','") +"');\">copy</A>]"

Make some test modifications to the copyvalues function, like

    function copyvalues(Objective, Level) {
        alert("Objective= " + Objective);
        alert("frame= " + window.frames[0].name);
        window.frames[0].elements[Objective].value= Objective;
        window.frames[0].elements[Level].value= Level;
    }  

I think you're messing with the wrong frame/window.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi
I have chaged as u say, but nuthing still

I call the window fine and if i click on any doc, nuthing happens. Does it transfer on a single click or double? Cause niether work either way.

All i see, is a view in the new window. How does it know to transfer the values back on a click?
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Is there anyother way of checking which frame its trying to transfer the values back to?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
The first you have to prove is that the function copyfields is called. if we know that, we can investigate further. If need be, send me (and anybody else asking for it) an example database, if possible a functioning one. You can find my mail address in my profile.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi Sjef

I have you the db.Please let me know if you get it.

Thank you for offering to help.

Regards
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Switch of the applet in the Embedded view, set it to view as HTML. Adding HTML to an applet isn't possible :(
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
You mean the view "picklistobjective". I have done that. its not embedded by the way.

I just to make sure that you were reffering to the advanced tab and tick "treat view content as HTML"

did you manage to get it to work on you side.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Oh, yes, it is embedded! There are several things to change (as I found out):
- treat content as HTML: no! use applet: no!
- it should not come as a surprise that you use ViewTemplateDefault ;) the embedded view in there overrules the settings of the view itself, so either create a form called "ViewTemplate for picklistobjective" or set the embedded view to the default. I managed to get some lines with HTML here.
- the copyfields function is in the wrong form, it should be in the newly create one
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

sorry, i replied to your personal inbox. My mistake.

here is the mail
Thank you once again. I know my first solution works, but its very unfriendly and BAD!!!!
When you said " create a form called "ViewTemplate for picklistobjective" " , do you mean, actuall create a form called "Viewtemplate" and embedd the view "PicklistObjective" onto the form and then call the form from the main window.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
You say the copyfield function is in the wrong form.
Should it be in the new form that you want me to create?
0
 
LVL 46

Accepted Solution

by:
Sjef Bosman earned 125 total points
Comment Utility
Yes twice. The new form should be called "$$ViewTemplate for PicklistObjective", it should have an embedded view (unimportant which view!) or a field called $$ViewBody.
You don't have to call the form, just call the view as you did, the template/form will be picked up automatically.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

I manage to get the view to popup in the $$viewtemplate form that i created.
I have an embedded view in it which displays using HTML.

I can see the "copy" link and the first alert pops up.
function copyvalues(Objective, Level) {
alert("Objective= " + Objective);
window.frames[0].elements[Objective].value= Objective;
window.frames[0].elements[Level].value= Level;
}

but then there is a error at the bottom. "window.frames.0.elements" is null or not an object

I thought it was the line that said
 alert("frame= " + window.frames[0].name); and took it out.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

I think i figured it out

I used
window.opener.document.forms[0].Objective.value= Objective;

and it returned the right value for one of the fields.
Let me try it on the other field as well and then I will do the rain dance.

Will let you know.  Man, its a good feeling when 1 little part works.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
You can always turn things around, and test with
    alert(window.opener)
then
    alert(window.opener.document)
    alert(window.opener.document.forms[0])
    alert(window.opener.document.forms[0].Objective)
    alert(window.opener.document.forms[0].Objective.value)

If you have a JS-manual with all the properties, use some of them (like name) so you can see that you're using the right names. Btw. don't try to use frames[0], but use the frame's name instead. If you decide to create a new frame some day, you're in Trouble.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Well that was a beautiful solution.

Thank you so much for your assistance and patience in helping me out on this one.

One more query, never done it.
Is it possible to do a @dblookup on a view column?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
@DbLookup ON or IN a column? The latter is not possible, the former is common practice: you need a value in the first column that is sorted or categorized. Cannot @DbLookup in other columns. From LS you can do a GetDocumentsByKey on multiple sequential columns, but always starting with the first column.
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
By on i mean, physically on the column itself.
Bascially on the column Formula, do a @dblookup.

Will try it tommorow though.  Right now touching up on look and feel of the window.

Thanx
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
Example please (must be may lak of inglis nolledj)
0
 

Author Comment

by:Rohith_Thomas
Comment Utility
Hi

Tried it, doesnt work.  Thank you anyway.

Whats inglis nolledj?
0
 
LVL 46

Expert Comment

by:Sjef Bosman
Comment Utility
I meant to say: can you give me an example please, I don't quite understand where you're going. Must be my lack of English knowledge. I call it a day, I'm getting tired and answering two questions for the price of 125 points is too much ;)

Glad you managed to get it to work! I suppose you will add additional window.open parameters, to hide window buttons, status and the lot?
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now