This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > August 2004 > Open Window using Javascript inside VB





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Open Window using Javascript inside VB
B-Dog

2004-08-17, 12:15 pm

I'm trying to redirect to a record insert page and also popup a new window
after each insertion. I've tried the following below and I can't seem to
get any to work. Is this possible?
Thanks


If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
javascript:window.open("Printlabel.asp")
End If


and

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
<script language="JavaScript" type="text/JavaScript">
window.open(printlabel.asp,PrintLabel,width=300,height=150)
</script>
End If


Kindler Chase

2004-08-17, 12:15 pm

B-Dog wrote:
> I'm trying to redirect to a record insert page and also popup a new
> window after each insertion. I've tried the following below and I
> can't seem to get any to work. Is this possible?
> Thanks
>
>
> If (MM_editRedirectUrl <> "") Then
> Response.Redirect(MM_editRedirectUrl)
> java script:window.open("Printlabel.asp")
> End If
>
>
> and
>
> If (MM_editRedirectUrl <> "") Then
> Response.Redirect(MM_editRedirectUrl)
> <script language="JavaScript" type="text/JavaScript">
>
> window.open(printlabel.asp,PrintLabel,width=300,height=150)
> </script>
> End If



You're trying to mix server side code (ASP/VBScript) with client side code
(JavaScript) and execute them at the same time. You can not do that.

Leave the default redirect in place. Then on the page the user get's
redirected to, you can set an onload event to open the pop up. Keep in mind
that a lot of folks use pop up blockers and will likely never see the pop
up.

Alternatively, you can create a pop up window when the user clicks the
submit button.

--
kindler chase
http://www.ncubed.com
Home of SuperInvoice's Fortress of BeanCounters

news://news.ncubed.com/support
n3 Support Group


B-Dog

2004-08-17, 7:14 pm

Thanks, this is for our company intranet so popup blockers won't be an issue
and I would like to do this on form submit but I have a question. If I do
it on form submit and their is verification needed will this popup even if
it can't verify? I'm trying to only do this if everything is verified and
inserted into the table. Thanks!


"Kindler Chase" <weaver@DELETEME_roubaixinteractive.com> wrote in message
news:cft70h$e3i$1@forums.macromedia.com...
> B-Dog wrote:
>
>
> You're trying to mix server side code (ASP/VBScript) with client side code
> (JavaScript) and execute them at the same time. You can not do that.
>
> Leave the default redirect in place. Then on the page the user get's
> redirected to, you can set an onload event to open the pop up. Keep in

mind
> that a lot of folks use pop up blockers and will likely never see the pop
> up.
>
> Alternatively, you can create a pop up window when the user clicks the
> submit button.
>
> --
> kindler chase
> http://www.ncubed.com
> Home of SuperInvoice's Fortress of BeanCounters
>
> news://news.ncubed.com/support
> n3 Support Group
>
>



Kindler Chase

2004-08-17, 7:15 pm

B-Dog wrote:
> Thanks, this is for our company intranet so popup blockers won't be
> an issue and I would like to do this on form submit but I have a
> question. If I do it on form submit and their is verification needed
> will this popup even if it can't verify? I'm trying to only do this
> if everything is verified and inserted into the table. Thanks!


Then you should use the pop up on the page the user is redirected to upon
success.

--
kindler chase
http://www.ncubed.com
Home of SuperInvoice: The Online Invoicing Application.
Organize your billing process and impress your clients.

news://news.ncubed.com/support
n3 Support Group


B-Dog

2004-08-17, 7:15 pm

But I'm redirecting to the same page, it is a database insertion page.

"Kindler Chase" <weaver@DELETEME_roubaixinteractive.com> wrote in message
news:cftcpt$kj7$1@forums.macromedia.com...
> B-Dog wrote:
>
> Then you should use the pop up on the page the user is redirected to upon
> success.
>
> --
> kindler chase
> http://www.ncubed.com
> Home of SuperInvoice: The Online Invoicing Application.
> Organize your billing process and impress your clients.
>
> news://news.ncubed.com/support
> n3 Support Group
>
>



Kindler Chase

2004-08-17, 7:15 pm

B-Dog wrote:
> But I'm redirecting to the same page, it is a database insertion page.


No Problem :)

If you are redirecting to the same page, the add a parameter to the URL,
i.e.,
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl & "&action=popup")
End If


Then in the page, just call the onload event conditionally based on the
action parameter, i.e.,

<%
Dim blnPopUp
If Request.QueryString("action") = "popup" Then
blnPopUp = True
Else
blnPopUp = False
End If
%>

<body ..some stuff...
<% If blnPopUp Then %>
onload="scriptToOpenPopUp"
<% End If %>
>


note: the closing > of the body tag is just below the if/then.

--
kindler chase
http://www.ncubed.com
Grooving with SuperInvoice

news://news.ncubed.com/support
n3 Support Group


B-Dog

2004-08-17, 7:15 pm

Thanks, I was thinking of something like that but didn't know how.
Appreciate it, I'll give it a shot.


"Kindler Chase" <weaver@DELETEME_roubaixinteractive.com> wrote in message
news:cftilo$qbu$1@forums.macromedia.com...
> B-Dog wrote:
>
> No Problem :)
>
> If you are redirecting to the same page, the add a parameter to the URL,
> i.e.,
> If (MM_editRedirectUrl <> "") Then
> Response.Redirect(MM_editRedirectUrl & "&action=popup")
> End If
>
>
> Then in the page, just call the onload event conditionally based on the
> action parameter, i.e.,
>
> <%
> Dim blnPopUp
> If Request.QueryString("action") = "popup" Then
> blnPopUp = True
> Else
> blnPopUp = False
> End If
> %>
>
> <body ..some stuff...
> <% If blnPopUp Then %>
> onload="scriptToOpenPopUp"
> <% End If %>
>
> note: the closing > of the body tag is just below the if/then.
>
> --
> kindler chase
> http://www.ncubed.com
> Grooving with SuperInvoice
>
> news://news.ncubed.com/support
> n3 Support Group
>
>



B-Dog

2004-08-17, 7:15 pm

Works but when I get redirected and submit again I get
"action=popup?action=popup" and so on.


"Kindler Chase" <weaver@DELETEME_roubaixinteractive.com> wrote in message
news:cftilo$qbu$1@forums.macromedia.com...
> B-Dog wrote:
>
> No Problem :)
>
> If you are redirecting to the same page, the add a parameter to the URL,
> i.e.,
> If (MM_editRedirectUrl <> "") Then
> Response.Redirect(MM_editRedirectUrl & "&action=popup")
> End If
>
>
> Then in the page, just call the onload event conditionally based on the
> action parameter, i.e.,
>
> <%
> Dim blnPopUp
> If Request.QueryString("action") = "popup" Then
> blnPopUp = True
> Else
> blnPopUp = False
> End If
> %>
>
> <body ..some stuff...
> <% If blnPopUp Then %>
> onload="scriptToOpenPopUp"
> <% End If %>
>
> note: the closing > of the body tag is just below the if/then.
>
> --
> kindler chase
> http://www.ncubed.com
> Grooving with SuperInvoice
>
> news://news.ncubed.com/support
> n3 Support Group
>
>




Kindler Chase

2004-08-17, 7:15 pm

B-Dog wrote:
> Works but when I get redirected and submit again I get
> "action=popup?action=popup" and so on.


DW tends do that, huh? I forget, does the dialogue box provide you an
option to exclude URL parameters when redirecting?

If not, then try this:

If (MM_editRedirectUrl <> "") Then
Session("popup") = True
Response.Redirect(MM_editRedirectUrl & "&action=popup")
End If



<body ..some stuff...
<% If Session("popup") Then %>
onload="scriptToOpenPopUp"
<%
Session.Contents.Remove("popup")
End If
%>
>


note: it's important to remove the session just before the end if, otherwise
the pop up will happen every time the page is viewed is the session
persists.


--
kindler chase
http://www.ncubed.com
SuperInvoice: For the Financially Unorganized

news://news.ncubed.com/support
n3 Support Group


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews