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

Disabling Buttons on the Client

1 Answer 71 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Christopher Blickley
Top achievements
Rank 2
Christopher Blickley asked on 20 Jul 2010, 01:50 AM
Hello:

Are there any known issues with disabling a button on the client in WebKit browsers?  I would like to disable the buttons on the client, for example when the page is sumbmitted. This works fine without RadFormDecorator, but with RadFormDecorator, it doesn't work in Safari or Chrome.  The button gets disabled, but style doesn't change.  I was hoping for something that would be seamless between when the decorator is in use or not use so I don't have any custom javascript just for RadFormDecorator and can remove or disable it at will.  Here is a quick example aspx page that correcly changes the style in Firefox and IE, but not in Chrome/Safari.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ 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">
  
<head runat="server">
    <title></title>
    <telerik:RadScriptBlock runat="server" ID="RadScriptBlock1">
    <script type="text/javascript">
        function test() {
            document.getElementById('<%= btnTest.ClientID %>').disabled = true;
        }
    </script>
    </telerik:RadScriptBlock>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <telerik:RadFormDecorator enabled="true" runat="server" ID="RadFormDecorator1" DecoratedControls="Buttons" />
        <asp:Button runat="server" ID="btnTest" Text="Disable Me" />
        <br />
        <br />
        <input type="button" value="Go" onclick="test();" />
    </div>
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 20 Jul 2010, 04:21 PM
Hello Christopher,

You should use  Telerik.Web.UI.RadFormDecorator.set_enabled method, e.g.
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>  
<!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>  
    <title></title>   
    <script type="text/javascript">
        function toggleEnable()
        {
            var btn = $get('nextButton');
            Telerik.Web.UI.RadFormDecorator.set_enabled(btn, btn.disabled)
        }   
    </script>  
</head>  
<body>  
    <form id="form1" runat="server">   
    <asp:ScriptManager ID="ScriptManager1" runat="server">   
    </asp:ScriptManager>  
    <telerik:RadFormDecorator ID="RadFormDecorator1" runat="server" />  
    <input type="button" value="setEnableDisableToTheNextButton" onclick="toggleEnable()"/>   
    <input type="button" id="nextButton" value="NEXT BUTTON" />  
    </form>  
</body>  
Let us know if you have any other questions.


Best wishes,
Petio Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
FormDecorator
Asked by
Christopher Blickley
Top achievements
Rank 2
Answers by
Petio Petkov
Telerik team
Share this question
or