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

Problem with default action on buttons

10 Answers 154 Views
FormDecorator
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 10 Jul 2008, 09:45 AM
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

10 Answers, 1 is accepted

Sort by
0
Dan
Top achievements
Rank 1
answered on 10 Jul 2008, 09:48 AM
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
0
Georgi Tunev
Telerik team
answered on 10 Jul 2008, 02:13 PM
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
0
Dan
Top achievements
Rank 1
answered on 10 Jul 2008, 03:21 PM
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


0
Accepted
Georgi Tunev
Telerik team
answered on 11 Jul 2008, 11:08 AM
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
0
Dan
Top achievements
Rank 1
answered on 14 Jul 2008, 07:35 AM
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
0
Georgi Tunev
Telerik team
answered on 14 Jul 2008, 10:17 AM
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
0
Dan
Top achievements
Rank 1
answered on 14 Jul 2008, 11:04 AM
Georgi,

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

--
Stuart
0
Georgi Tunev
Telerik team
answered on 14 Jul 2008, 02:22 PM
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
0
Dan
Top achievements
Rank 1
answered on 14 Jul 2008, 02:29 PM
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




0
Georgi Tunev
Telerik team
answered on 15 Jul 2008, 01:39 PM
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
Tags
FormDecorator
Asked by
Dan
Top achievements
Rank 1
Answers by
Dan
Top achievements
Rank 1
Georgi Tunev
Telerik team
Share this question
or