ClientScript working in IE but not Mozilla

R

RuthG

I have date text boxes on my page and am trying to fill them from a
pop up
calendar window. I can display the popup in both IE and Mozilla
Firefox, when
I click in the text box. Here is the code to display it:

<input ID="FirstPaymentDate" type="text" runat="server"
onclick="javascript:calendar_window=window.open('calendar.aspx?
formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus
()"/>

But when I select a date from the calendar, my code fills in the date
in my
textbox and closes the calendar in IE, but not in Mozilla. The lines
of code
are being processed when I step through them with the debugger, but
nothing
is happening. Here is the VB.Net code:

Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As
System.EventArgs)
Dim strjscript As String
strjscript = "window.opener." &
HttpContext.Current.Request.QueryString("formname") & ".value = '" &
Calendar1.SelectedDate & "';window.close();"
ClientScript.RegisterStartupScript(Me.GetType(),
Guid.NewGuid().ToString, strjscript,true)
End Sub

Instead of the last line, I also tried putting the script in a literal
to
execute when it is rendered:
Literal1.Text = "<script language=""javascript"">" & strjscript & "</
script"
& ">"

I also tried to register an on submit and had a submit button on the
calendar form:
ClientScript.RegisterOnSubmitStatement(Me.GetType(),
Guid.NewGuid().ToString, strjscript)

Nothing happened in all these cases.

I think the problem may be a security setting in Mozilla, but I can't
find
it. Java scripts and their debugging is enabled. Blocking or
unblocking pop
up windows makes no difference. Any suggestions? I want this code to
work in
all browsers.
 
V

VK

I have date text boxes on my page and am trying to fill them from a
pop up
calendar window. I can display the popup in both IE and Mozilla
Firefox, when
I click in the text box. Here is the code to display it:

<input ID="FirstPaymentDate" type="text" runat="server"
onclick="javascript:calendar_window=window.open('calendar.aspx?
formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus
()"/>

But when I select a date from the calendar, my code fills in the date
in my
textbox and closes the calendar in IE, but not in Mozilla. The lines
of code
are being processed when I step through them with the debugger, but
nothing
is happening. Here is the VB.Net code:

Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As
System.EventArgs)
Dim strjscript As String
strjscript = "window.opener." &
HttpContext.Current.Request.QueryString("formname") & ".value = '" &
Calendar1.SelectedDate & "';window.close();"
ClientScript.RegisterStartupScript(Me.GetType(),
Guid.NewGuid().ToString, strjscript,true)
End Sub

Instead of the last line, I also tried putting the script in a literal
to
execute when it is rendered:
Literal1.Text = "<script language=""javascript"">" & strjscript & "</
script"
& ">"

I also tried to register an on submit and had a submit button on the
calendar form:
ClientScript.RegisterOnSubmitStatement(Me.GetType(),
Guid.NewGuid().ToString, strjscript)

Nothing happened in all these cases.

I think the problem may be a security setting in Mozilla, but I can't
find
it.

Neither Firefox nor other browsers support ASP.NET Server Controls.
Either make IE-only solution or drop all these runat="server" and use
one of Javascript-based popup calendars to fill the form field.
 
M

Martin Honnen

RuthG said:
I have date text boxes on my page and am trying to fill them from a
pop up
calendar window. I can display the popup in both IE and Mozilla
Firefox, when
I click in the text box. Here is the code to display it:

<input ID="FirstPaymentDate" type="text" runat="server"
onclick="javascript:calendar_window=window.open('calendar.aspx?
formname=frmTenant.FirstPaymentDate','calendar_window','width=180,height=198,top=350,left=320');calendar_window.focus
()"/>

But when I select a date from the calendar, my code fills in the date
in my
textbox and closes the calendar in IE, but not in Mozilla. The lines
of code
are being processed when I step through them with the debugger, but
nothing
is happening.

What exactly fails in Mozilla, filling in the selected date or closing
the popup window or both? Does the Mozilla error console show any script
errors? Did you debug the client-side JavaScript code with Firebug, or
what debugger are you talking about?
Here is the VB.Net code:

Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e
As
System.EventArgs)
Dim strjscript As String
strjscript = "window.opener." &

Try a
window.opener.document.
instead of window.opener.

I think the problem may be a security setting in Mozilla, but I can't
find
it.

Check the error console of the Mozilla browser, if there was a security
violation then it will show that.
 
R

RuthG

What exactly fails in Mozilla, filling in the selected date or closing
the popup window or both? Does the Mozilla error console show any script
errors? Did you debug the client-side JavaScript code with Firebug, or
what debugger are you talking about?

 > Here is the VB.Net code:




Try a
                 window.opener.document.
instead of      window.opener.


Check the error console of the Mozilla browser, if there was a security
violation then it will show that.

Thanks for your comments. I replaced it with a Javascript popup and it
works fine.
 
M

Michael J. Ryan

Neither Firefox nor other browsers support ASP.NET Server Controls.
Either make IE-only solution or drop all these runat="server" and use
one of Javascript-based popup calendars to fill the form field.

FYI, ASP.Net sever controls render out HTML that tends to run fine in most
browsers. Blanket statements like this only show an ignorant bias.
personally, I would lean towards the jQueryUI datepicker, just the same.
 
D

David Mark

FYI, ASP.Net sever controls render out HTML that tends to run fine in most
browsers.

Based on your observations? Take the number of known browsers,
multiply by the number of platforms and configurations and realize
that empirical evidence of success is the last thing you should rely
on. This is particularly true of markup and code from dubious sources
(e.g. anything generated by ASP.NET.)
Blanket statements like this only show an ignorant bias.
personally, I would lean towards the jQueryUI datepicker, just the same.

Talk about ignorant. They test in a handful of browsers and treat the
"successful" results as significant (see above.) Must be some pretty
bad tests as well as they should certainly be seeing some failures by
now (which *are* significant.)
 
M

Michael J. Ryan

Based on your observations? Take the number of known browsers,
multiply by the number of platforms and configurations and realize
that empirical evidence of success is the last thing you should rely
on. This is particularly true of markup and code from dubious sources
(e.g. anything generated by ASP.NET.)

The point was, the output of ASP.Net server controls *IS* html, not IE voodoo.
Talk about ignorant. They test in a handful of browsers and treat the
"successful" results as significant (see above.) Must be some pretty
bad tests as well as they should certainly be seeing some failures by
now (which *are* significant.)

First off, what browsers beyond a handful would be reasonable to test in?
Should you include the original Mosaic? No, they don't work in all browsers,
and many configurations fail without js... Beyond this there are a frightening
number of 3rd party controls (and a couple of addons from ms) that are/were IE
specific...

You weren't talking about specific libraries, or addons though, you were
talking of ASP.Net itself, which outputs HTML. In the case of v3, valid XHTML
by default.

None of this changes the fact that you made a blanket statement showing
nothing more than ignorance, probably originating from some deep seeded
anti-ms zealotry. I've worked with a number of different web frameworks, and
have made tweaks to ASP.Net (prior to v3) to get the output renderer the way I
want it... you can force xhtml rendering in older versions too. personally, i
like the far greater control you get from ASP.Net MVC over ASP.Net webforms.
I also have avoided a lot of 3rd party controls simply because they've had too
little focus outside IE... but none of this makes the framework itself bad, or
something to be avoided wholesale as you suggest.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top