This is a migrated thread and some comments may be shown as answers.

[Solved] Client javascript won't run in FireFox

1 Answer 85 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
JustinWong
Top achievements
Rank 1
JustinWong asked on 14 Apr 2009, 04:06 AM

Hi:

I have a simple javascript triggered by a submit button:

. . .

<asp:Content ID="Content2" ContentPlaceHolderID="CPH1" runat="server">

<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

<script type="text/javascript">

<!-- Beginning of JavaScript -

function HasCompleteInfo()

{

theMDFName = document.getElementById('<%=Txt_MDFName.UniqueID%>').value;

if (theMDFName.length < 10)

{

alert ("Please enter a valid hospital name.");

return false;

} else if (ValidateEmail(document.getElementById('<%=Txt_EMail.UniqueID%>').value) == false) {

alert("Invalid email format.\nPlease enter a valid email in the format user@host.domain.");

return false;

} else {

return true;

}

}

 

function TestAJaxConditionAtStart(sender, args)

{

}

 

//-->

</script>

</telerik:RadCodeBlock>

<asp:ScriptManager ID="ScriptManager" runat="server" />

<telerik:radformdecorator id="RadFormDecorator1" Skin="WebBlue" runat="server" decoratedcontrols="all">

</telerik:radformdecorator>

<telerik:RadAjaxManager ID="RAJforForm"

ClientEvents-OnRequestStart="TestAJaxConditionAtStart"

runat="server">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="DDLCountry">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="DDLCountry" LoadingPanelID="ALP01" />

<telerik:AjaxUpdatedControl ControlID="DDLProv" LoadingPanelID="ALP01" />

</UpdatedControls>

</telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="BtnSubmit">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="pnlBackGround01" LoadingPanelID="ALP01" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<telerik:RadAjaxLoadingPanel ID="ALP01"

Transparency="40" BackColor="White" Height="75px" Width="75px"

runat="server">

<img id="ALPImg01"

alt="Loading..."

src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;"

/>

</telerik:RadAjaxLoadingPanel >

<asp:Panel ID="pnlBackGround01" BackImageUrl="./Images/WebBlue_Pnl_Bckgrd.gif" runat="server">

. . .

<asp:TextBox ID="Txt_MDFName" TextMode="SingleLine" Width="200px" MaxLength="100" Font-Size="8pt" runat="server" />

. . .
<asp:Button ID="BtnSubmit" Font-Size="8pt" Text="Submit" OnClientClick="if (!HasCompleteInfo()) return false;" OnClick="BtnSubmit_Click" runat="server" />

. . .

</asp:Panel>

</asp:Content>



The above javascript (HasCompleteInfo()) runs perfectly with IE, but the alert fails to be triggered in FireFox. I'm mystified as to why.  Any clarification would be appreciated.

 

Justin

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 14 Apr 2009, 02:03 PM
Hi Justin,

The problem does not seem to be related to RadControls, and what's more, I can't reproduce it locally. Please try to isolate and debug the issue and let us know if you need further assistance.

<%@ Page Language="C#" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
<title>RadControls for ASP.NET AJAX</title> 
</head> 
<body> 
<form id="form1" runat="server"
<asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
<script type="text/javascript"
 
function HasCompleteInfo() 
    theMDFName = document.getElementById('<%=Txt_MDFName.UniqueID%>').value; 
 
    if (theMDFName.length < 10
    { 
        alert ("Please enter a valid hospital name."); 
    } 
 
    return false; 
 
</script> 
</telerik:RadCodeBlock> 
 
<telerik:RadAjaxManager ID="RAJforForm" runat="server"
    <AjaxSettings> 
        <telerik:AjaxSetting AjaxControlID="BtnSubmit"
            <UpdatedControls> 
                <telerik:AjaxUpdatedControl ControlID="pnlBackGround01" /> 
            </UpdatedControls> 
        </telerik:AjaxSetting> 
    </AjaxSettings> 
</telerik:RadAjaxManager> 
 
<telerik:RadFormDecorator id="RadFormDecorator1" Skin="WebBlue" runat="server" 
DecoratedControls="all" /> 
 
<asp:TextBox ID="Txt_MDFName" TextMode="SingleLine" Width="200px" MaxLength="100" 
Font-Size="8pt" runat="server" /> 
 
<asp:Button ID="BtnSubmit" Font-Size="8pt" Text="Submit" 
OnClientClick="if (!HasCompleteInfo()) return false;" runat="server" /> 
 
<asp:Panel ID="pnlBackGround01" runat="server"
pnlBackGround01 
</asp:Panel> 
 
</form> 
</body> 
</html> 


Regards,
Dimo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Ajax
Asked by
JustinWong
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or