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,toolb ar=0,resiz able=0,scr ollbars=0, status=0,m enubar=0,d irectories =0,locatio n=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.
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,toolb
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.
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.
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.
ASKER
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.
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!)
@URLOpen("Javascript:alert
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!)
ASKER
hello crak,
sorry to ask to many question
i tried like this
1.@URLOpen("javascript:loc ation.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,toolb ar=0,resiz able=0,scr ollbars=0, status=0,m enubar=0,d irectories =0,locatio n=0');
return false;
}
else
{
the_window.focus();
}
}
</script>
can u please help .
waiting for ur reply.
saleem
sorry to ask to many question
i tried like this
1.@URLOpen("javascript:loc
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,toolb
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:locat ion.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.
I assumed you would adress it as:
@URLOpen("javascript:locat
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.
ASKER
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.
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,dire cories=no, hotkeys=no ,menubar=y es,resizab le=yes,loc ation=yes, scrollbars =yes,statu s=no,title bar=no,dep endent=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.....!
newURL = '<agentURL>';
top.popUp = window.open(newURL, 'PopUp', 'height=400,width=600,dire
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.....!
ASKER
hello crak,
As per ur hint
i wrote like this
newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newu rl,'popup' ,'height=4 00,width=6 00,direcor ies=no,hot keys=no,me nubar=yes, resizable= yes,locati on=yes,scr ollbars=ye s,status=n o,titlebar =no,depend ent=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.
As per ur hint
i wrote like this
newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newu
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).
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).
ASKER
hai crak,
here are the three lines
newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newu rl,'popup' ,'height=4 00,width=6 00,direcor ies=no,hot keys=no,me nubar=yes, resizable= yes,locati on=yes,scr ollbars=ye s,status=n o,titlebar =no,depend ent=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(newu rl,'popup' )eventhoug h 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.
here are the three lines
newurl='http://abc/abc.nsf/maillogin?openagent';
top.popup=window.open(newu
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(newu
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
ASKER
please check mail
Nothing received yet.....!?
ASKER
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.MailF ile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocume nt]"
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!
I've tested your code and think I have found a very easy solution:
Your agent contains following line:
Print "[http://shaik/" + ReplaceSubstring(doc.MailF
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
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!
ASKER
hello crak
thans for ur response.
you mean
print"location.href='/name s.nsf';" then no need of
+ ReplaceSubstring(doc.MailF ile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocume nt]"
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.
thans for ur response.
you mean
print"location.href='/name
+ ReplaceSubstring(doc.MailF
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.
ASKER
hello crak,
please send me the modified database to me.check mail.
please send me the modified database to me.check mail.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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='/"+Replace Substring( doc.mailfi le(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.
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='/"+Replace
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.
ASKER
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.
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.ns f")
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_Decode d(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.Ab breviated)
Print "<Script language=""Javascript"">"
Print "window.focus();"
Print "location.href='/" + ReplaceSubstring(doc.MailF ile(0), "\","/") + ".nsf" +"/iNotes/Mail/?OpenDocume nt';"
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!
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.ns
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_Decode
' 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.Ab
Print "<Script language=""Javascript"">"
Print "window.focus();"
Print "location.href='/" + ReplaceSubstring(doc.MailF
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!
ASKER
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 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?
I'm Dutch (Netherlands).
And you?
@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()