Problem with default action on buttons

11 posts, 1 answers
  1. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 10 Jul 2008 Link to this post

    Create a page with a textbox and a button on it. Add an OnClick event to the button.

    Run the page.

    Type something in the textbox and hit return. The browser reacts as if the button had been pressed and the server event fires.

    This is, as I understand it, the way things are supposed to work.

    Now, add a FormDecorator to the form. And run the test again.

    In Firefox the page continues to work the way you would expect. In IE7 (I'm not able to test IE6) hitting return does nothing (except cause a beep). This happens whether or not the FormDecorator is actually configured to decorate the button control; all that's necessary for the functionality to fail is for the FormDecorator to be on the page.

    Once again, I'm getting grief for this. Is there a workaround for this problem (other than removing the FormDecorator control)?

    --
    Stuart
  2. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 10 Jul 2008 Link to this post

    I should prolly say that I'm using build 619 and the page has all of the suggested fixes for FD applied to it.

    --
    Stuart
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 10 Jul 2008 Link to this post

    Hi Stuart,

    I tried to reproduce the problem locally but to no avail - using RadFormDecorator in such scenario didn't change the behavior of the controls. Indeed, when you type text in the textbox and press Enter, a postback will occur and the OnTextChanged event will be fired.
    For convenience I attached my test setup. Can you please check it and let me know if I have missed something?



    Regards,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 10 Jul 2008 Link to this post

    Georgi

    OK. Comparing the 2 tests (yours and mine) I note that I, as a good customer would, have used a telerik:RadTextBox rather than an asp:TextBox.

    If you replace the asp caontrol with the Rad in your example, you'll see what I mean.

    --
    Stuart


  6. Answer
    Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 11 Jul 2008 Link to this post

    Hello Stuart,

    Thank you for the additional information - I was able to reproduce the problem. Our initial investigation shows that this is most probably related to a bug in the IE browser itself - the same setup works fine in all other major browsers, however we will need more time for tracking down the actual reason.

    The good news is that there is an easy workaround - to wrap the RadTextBox and the button in an asp:panel along with a hidden button set as defaultbutton:

    <asp:Panel ID="Panel1" defaultbutton="submitButton" runat="server"
         
        <telerik:RadTextBox ID="RadTextBox1" runat="server" AutoPostBack="false" OnTextChanged="RadTextBox1_TextChanged"
        </telerik:RadTextBox> 
        <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" /> 
         
    <div style="display:none">  
    <script>  
    function submitLogin(button)  
    {  
        var loginButton = document.getElementById("<%= Button1.ClientID %>");   
        loginButton.click();              
        return false;  
    }  
    </script>  
    <asp:Button ID="submitButton" runat="server" OnClientClick="return submitLogin(this);"   
    text="Click me"/>  
    </div>  
    </asp:Panel> 

    I hope this helps.


    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 14 Jul 2008 Link to this post

    Georgi,

    Our initial investigation shows that this is most probably related to a bug in the IE browser itself

    Now why aren't I surprised by that?

    The good news is that there is an easy workaround
    Thanks for that.

    we will need more time for tracking down the actual reason
    I'd be grateful if you could post the results of your investigation here.

    --
    Stuart
  8. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Jul 2008 Link to this post

    Sure thing Stuart,

    Once I have more info on the subject, I will post here.


    Greetings,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 14 Jul 2008 Link to this post

    Georgi,

    FYI, if the RadInput is replaced with a RadComboBox then your supplied workaround doesn't work in IE

    --
    Stuart
  10. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Jul 2008 Link to this post

    Hello again Stuart,

    RadTextBox and RadCombobox do not have much in common, so I am not quite sure what exactly is your new scenario. Please provide more details on it and we will investigate.


    Greetings,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  11. Dan
    Dan avatar
    739 posts
    Member since:
    Mar 2009

    Posted 14 Jul 2008 Link to this post

    Hello matey.

    All I did was replace the textbox with a combobox in the form ...
            <asp:Panel ID="formpanel" DefaultButton="hiddenButton" runat="server"
              <telerik:RadComboBox ID="RadComboBox1" runat="server"
                <Items> 
                  <telerik:RadComboBoxItem Text="First" /> 
                  <telerik:RadComboBoxItem Text="Second" /> 
                  <telerik:RadComboBoxItem Text="Third" /> 
                </Items> 
              </telerik:RadComboBox> 
              <asp:Button ID="Button1" 
                  runat="server" Text="Submit" OnClick="Button1_Click" /> 
              <br /> 
              <asp:Label ID="Label1" runat="server"></asp:Label> 
              <br /> 
              <asp:Label ID="Label2" runat="server"></asp:Label> 
              <div style="display:none"
                <asp:Button ID="hiddenButton" runat="server" OnClientClick="return submitLogin(this);"     
                text="Click me"/>    
              </div> 
            </asp:Panel> 

    --
    Stuart




  12. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 15 Jul 2008 Link to this post

    Hi Stuart,

    OK, you replaced the RadTextBox control with RadComboBox, but what are the steps to reproduce the problem? I see that the combo doesn't have the AutoPostBack property set to true, so it will not fire a postback. Now if I remove the panel and the hidden button which are part of the workaround, there is no difference in the page's behavior no matter if there is RadFormDecorator on the page or not.
    Can you please open a ticket and provide full, working solution along with steps to reproduce? This will prevent further misunderstandings and we will do our best to help you right away.


    All the best,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017