Link to home
Start Free TrialLog in
Avatar of saleemkhan
saleemkhan

asked on

can we write formula and javascript as one event

hello experts,
    i have a ellispe button in navigator and when on this button.both individual is working fine.But
i want two things should happen on one button click

 1. @URLOpen("http://abc/abcTest.nsf/abclogin?     openagent")
  2.javascript code below like this


<script language="javascript">
var the_window = null;
function test()
{
if(!the_window  || the_window .closed)
{
the_window  = window.open('http://abc/abc.nsf/child?openform','tie','left=30,top=200, width=500,height=600,toolbar=0,resizable=0,scrollbars=0,status=0,menubar=0,directories=0,location=0');
 return false;
}
else
{
 the_window.focus();
}
}
</script>
<input type=button onclick="test()" value="new">

i dont want to click on the new button.when i click on ellispe button it will open mailfile window if the same window is minimized when click again on the ellispe button it should be maximized.

can we achieve the both should work in on ellispe click

can anybody will help me.


Saleem.
Avatar of CRAK
CRAK
Flag of Netherlands image

The javascript code for
@URLOpen("http://abc/abcTest.nsf/abclogin?    openagent")
is:
window.location.href="http://abc/abcTest.nsf/abclogin?openagent"

Simply add that code to your button, and start the function on the next line:

window.location......
test()

Avatar of saleemkhan
saleemkhan

ASKER

hello crak,
   i wrote the code ellispse button.we can write only 1.formula
2.simple action
3.lotus script
 
so on ellispe click(ellispe is there in navigator)
1.i want formula @urlopen("http://abc/abctest.nsf/abclogin?openagent")
2.And the ellispe button click event i want to write
the java script code.


  i think for ellipse button we cant write javascript code.can we?
can u help reg this.

saleem.
hello crak,
  i think my question is some what confusing u

here is my question

1.i have one formula @urlopen

2.one javascript code.


what i want is when i click on ellispe button i want both the both(formula as well as javascript code) should work .

Both of them are working individually fine.


waiting for reply.

saleem.
Use this formula:

@URLOpen("Javascript:alert(\'Perform 1st action here\'); alert(\'Perform 2nd action here\')")

Substitute both alert()-instructions for the location.href= and the function call.

I hope the function is called before the new URL gets loaded....
(You could change the URL from inside the function to!)
hello crak,
  sorry to ask to many question
i tried like this

1.@URLOpen("javascript:location.href=(\'http://abc/abctest.nsf/abclogin?openagent\');location.href=(\'test()\')")

but the problem is i am writing the formula in navigator in ellipse button but as u said function is calling before the url and the problem is i cant put html code in a navigator.

the javascript code is like this
<script language="javascript">
var the_window = null;
function test()
{
if(!the_window  || the_window .closed)
{
the_window  = window.open('http://abc/abc.nsf/child?openform','tie','left=30,top=200, width=500,height=600,toolbar=0,resizable=0,scrollbars=0,status=0,menubar=0,directories=0,location=0');
return false;
}
else
{
the_window.focus();
}
}
</script>
can u please help .

waiting for ur reply.

saleem
You mean that location.href=(\'test()\') actually worked?
I assumed you would adress it as:
@URLOpen("javascript:location.href=(\'http://abc/abctest.nsf/abclogin?openagent\'); test()")

Anyway; you'll still get stuck on the same problem.

I think you are trying to execute an agent in the current window, and load/focus a login pop-up window (you may want to add a focus-instruction in the window.open-block as well...).

Is it possible just to open that pop-up window, and when closing it (in an onClick or onSubmit-event) set opener.location.href to the agent's url?

As you've seen it's easy to perform two things in one click, but to really solve your problem I need to find out what the real problem is that you're trying to solve.
hello crak,
  what u said is correct.i want to execute an agent(what this agent will do is i will open a perticular user mail file)in the parent window and show his mail file in a popup window.if the popup window is minimized if the user agin click on main window button again the popup window should open.
    my problem i am using framset and in the frame i am embedding navigator when click on the navigator ellispe button the above two events should happen.


can u help me reg this.
Try this in the button:

newURL = '<agentURL>';
top.popUp = window.open(newURL, 'PopUp', 'height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popUp.focus();

Change parameters where applicable and make sure the agent launches the url to the mailbox.

A popUp handler is stored in the frameset (top). As the frameset is not reloaded, the handler should stay there.
If the user activates the routine again, the handler is re-used, so the popup-window is re-used; if closed, minimised, blurred or focussed.....!
hello crak,
  As per ur hint
i wrote like this

newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newurl,'popup','height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popUp.focus();

i am getting an operator or semicolon was expected but none was expected and its pointing at popup.what is the error.


the newurl is the url which opens a perticular user mailbox.

waiting for reply.

saleem.

There are supposed to be three (3) lines:

newurl=...;

top.popup=.....;

top.popup.focus();


There is one little error in your code: you wrote:
top.popup=window......
and:
top.pupUp.focus()

As javascript is case-sensitive, make the popup-phrases identical; either popup or popUp (whatever you like, as long as their upper/lowercase characters match).
hai crak,

here are the three lines

newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newurl,'popup','height=400,width=600,direcories=no,hotkeys=no,menubar=yes,resizable=yes,location=yes,scrollbars=yes,status=no,titlebar=no,dependent=yes');
top.popup.focus();

in code i put them correct only but by mistake i send u wrong.
what i did is i just removed the  third line and in the second line like
top.popup=window.open(newurl,'popup')eventhough i am getting "an operator or semicolor was expected but none was expected".
  its stopping at popup.


can u help me in this.
if u help in this i will be relieved from a big problem.
otherwise if u send ur mail i will the database as attachemnet so its easy for u to debug.
please.
waiting for reply.
saleem.


notes.domino@12move.nl
please check mail
Nothing received yet.....!?
i send but delivery failure once again sending to the address.please check again.
Wow.... received both now. What a delay!

I've tested your code and think I have found a very easy solution:

Your agent contains following line:

Print "[http://shaik/" + ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument]"

I have not been able to test it with that specific url, so I replaced it with one opening names.nsf. If you replace your line of code with following (and re-define the url) it should work just as you wish:

Print "<Script language=""Javascript"">"
Print "window.focus();"    
Print "location.href='/names.nsf';" ' open the correct url here
Print "</Script>"

As you can see I am NOT using referring to a specific server ("http://shaik"): starting the url with "/" will open the specified url from the "current server". If you would run it on a different server, or rename "shaik", it would still work (i.e. if application server = mail server).

Good luck!
hello crak

thans for ur response.
you mean
print"location.href='/names.nsf';" then no need of

+ ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument]"
i replaced the print stat with the above print stat.but
its taking very long time to run the application.
can u please send the steps to be done.


saleem.
hello crak,
   please send me the modified database to me.check mail.
ASKER CERTIFIED SOLUTION
Avatar of CRAK
CRAK
Flag of Netherlands image

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
hai crak,
  can u please send me the print stat to open mail file.when i tried with the print stat i am getting object varible not set when i tried with
Print "location.href='/"+ReplaceSubstring(doc.mailfile(0),"\","/")+".nsf"+"';"

its redirecting to again admin mail file.
the url the mail file should be like this
http://shaik/mail/admin.nsf/iNotes/Mail/?OpenDocument


can u please send me the print stat(to open mail file) also.

waiting for reply.

saleem.

for abc user
http://shaik/mail/abc.nsf/inotes/mail/?opendocumnet
for testuser user
http://shaik/mail/testuser.nsf/inotes/mail/?opendocumnet
sorry to ask so many questions.

waiting for reply.
Sorry...
I thought you'd understand to use your original URL definition instead of the /names.nsf one that I used for testing.
The exact code under initialise in the shaikmaillogin-agent should be:



Dim s As New Notessession
Dim db As New NotesDatabase("","names.nsf")
Dim user As NotesName
Dim v As NotesView
Dim doc As NotesDocument
Dim QueryStr As String
Dim CurDoc As NotesDocument
Dim p As Integer

Set CurDoc = s.DocumentContext ' Agent environment contains CGI fields
' retrieve decoded Query_String
QueryStr = CurDoc.Query_String_Decoded(0)
' isolate data passed after &Usr= (I assume nothing trails that parameters data)
Parm = "&Usr="
p = Instr(1, QueryStr, Parm)
QueryStr = Right$(QueryStr, (Len(QueryStr)+1) - (p+Len(Parm)))
' use remainder as username
Set user = New NotesName(QueryStr)
     
Set v = db.GetView("($Users)")
Set doc = v.GetDocumentbyKey(user.Abbreviated)
Print "<Script language=""Javascript"">"
Print "window.focus();"    
Print "location.href='/" + ReplaceSubstring(doc.MailFile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocument';"
Print "</Script>"



Have not been able to test this: I don't use web-enabled mail. However, the generated URL's do match the decribed format and are retrieved from the public NAB...
Should work!
hai crak,
   Thanks once again for ur kind help.U helped with a lot of patience.i asked so many silly questions eventhough u helped me a lot.In future i need ur help.May be tomorrow i will send u mail.i have one more problem.
  where are u from.



Thanks once again. for giving me such a good information.

saleem.
Thanks!

I'm Dutch (Netherlands).
And you?