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

Problem with DefaultButton in Q2 2012

15 Answers 197 Views
Input
This is a migrated thread and some comments may be shown as answers.
Hunter
Top achievements
Rank 1
Hunter asked on 13 Jun 2012, 10:38 PM
Did this issue come back to life in Q2? After upgrading to Q2 the issue described here was noticed in my login page which contains two radTextboxes and a radButton placed within an asp panel (default button set to radButton). If you enter a user name then use tab to enter the password, hitting enter on your keyboard (while radTextbox has focus) does nothing. Only after hitting the enter button twice or using the mouse to click back to the first textbox makes the enter key work. I tried setting the EnableSingleInputRendering to false but this did nothing. If I replace the radTextbox with an asp textbox everything works as expected.

15 Answers, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 14 Jun 2012, 07:08 AM
Hello Hunter,

I tested the sample code from the other thread and it is working correct with the Q2 2012.
Do you have any specific code in your page? Do you have asp:validators to validate your inputs?

Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hunter
Top achievements
Rank 1
answered on 14 Jun 2012, 03:11 PM
Interesting, yes I have an asp required field validator for each textbox.
0
Shukhrat Nekbaev
Top achievements
Rank 1
answered on 15 Jun 2012, 06:56 AM
Hi,

I have similar issue with Q2 2012 (was ok previously), I have a page with 2 RadTextBoxes. First is email + 2 validators (required field and regular expression), second is password (required field). Both have ClientEvents-OnKeyPress bound. In this js function I check if key is an enter key (args.get_keyCode() == 13) and click on a button. This has been working for months already. Now it's not :) If I input text to both textboxes and press enter while second is focused I get validator error: password is required, similarly if first is focused - validator saying that email is required appears. Pressing enter key second time does the login. (controls are inside LoginControl with LayoutTemplate and everything is inside updatepanel).

My current workaround is adding a timeout:
function loginKeyDown(event, args) {
    if (args.get_keyCode() == 13) {
        setTimeout(function() {
            $('#<%= (PGC.WebApp.BL.Utils.HelperMethods.FindControlRecursive(loginCtrl, "LoginButton") as Button).ClientID %>').click();  
        }, 50);
    }
}

0
Accepted
Vasil
Telerik team
answered on 15 Jun 2012, 11:31 AM
Hi Shukhrat,

I can confirm that there is issue with RadInputControl in combination with Validator and Default button. The current solution is to override the _onTextBoxKeyDownHandler as follows:

<script type="text/javascript">
    Telerik.Web.UI.RadInputControl.prototype._onTextBoxKeyDownHandler = function (e)
    {
        if ((e.keyCode == 13 || e.keyCode == 9) && !this.isMultiLine())
        {
            this._updateHiddenValue();
        }
 
        if (e.keyCode == 27 && !$telerik.isIE)
        {
            var that = this;
            window.setTimeout(function ()
            { that.set_textBoxValue(that.get_editValue()); }, 0);
        }
    }
</script>

Place the script under the declaration of your ScriptManager.

Kind regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Shukhrat Nekbaev
Top achievements
Rank 1
answered on 15 Jun 2012, 12:07 PM
Hi,

thanks for the reply, I've replaced my workaround with yours :)

P.S.: checked in IE9 (IE8 mode), IE9, Safari, FF, Chrome, seems to be ok
0
Hunter
Top achievements
Rank 1
answered on 16 Jun 2012, 03:58 PM
Thanks guys, works for me too! Now for the million dollar question.... When do you think we might see a fix for this? Should I add something to pits? Thanks again.
0
Vasil
Telerik team
answered on 18 Jun 2012, 10:23 AM
Hello Hunter,

This will be fixed in the next published internal build next week. You could see the status in PITS here:
http://www.telerik.com/support/pits.aspx#/public/aspnet-ajax/11505

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Hunter
Top achievements
Rank 1
answered on 18 Jun 2012, 02:40 PM
Thanks!
0
Chris Dalessandri
Top achievements
Rank 1
answered on 23 Jun 2012, 04:09 PM
This solution does not seem to be working for me.  My situation is similar (radtextboxes with validators) but I want to click a button myself and stop the event from propagating.  The code I've used for this is:
function keyPressHandler(sender, args) {
    if (args.get_keyCode() == 13) {
        args.set_cancel(true);
        document.getElementById('<%= btnSave.ClientID %>').click();
    }
}

This code has been working for a long time.  After the latest update it does not.  If I remove the set_cancel, it works in the simple case.  But on some pages I have multiple textboxes and multiple buttons and I really need to ensure that no event bubbles. I tried using get_domEvent() and canceling the event myself but that did not work.

Help, please.

Thank you,
0
Vasil
Telerik team
answered on 27 Jun 2012, 08:34 AM
Hello Chris,

Use sender.blur(); Or sender.set_value(sender.get_textBoxValue() ) ; when you cancel the event if you still like the text to be considered as changed.

All the best,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Chris Dalessandri
Top achievements
Rank 1
answered on 28 Jun 2012, 02:18 PM
Just in case anyone has a similar problem, Telerik has confirmed that there is a problem with RadInput when canceling the keypress event and they are looking into it.
0
Vasil
Telerik team
answered on 03 Jul 2012, 08:18 AM
Hello,

The issue when with the canceling the event will be fixed in 10th June hotfix. So in Service Pack of Q2 it will work correct.

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Marc Messer
Top achievements
Rank 2
answered on 14 Sep 2012, 06:33 PM
Anyone else still having an issue with this?  I just tested and all the browsers seem to be ok except for IE 8.  I have even updated my dev environment to the latest september release with no success.  I've sent a support ticket: 605410 but they want me to send a stripped down version of a CMS / E-Commerce platform over to them.  
0
Marc Messer
Top achievements
Rank 2
answered on 14 Sep 2012, 06:50 PM
I actually figured out what was causing the issue... another piece of code that is needed for default buttons on the site.  Now just need to fix this code to be compatible with Q2 SP1...

$("span[DefaultButton]").each(function () {
    var s = $(this).attr("DefaultButton");
    $("input[type='text'], input[type='password']", this).keydown(function (e) {
        var k = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
        if (k == 13) {
            e.preventDefault();
            var b = $("#" + s).eq(0);
            if (b.length > 0) {
                if (typeof (b.get(0).onclick) == 'function') { b.trigger('click'); }
                else if (b.attr('href')) { window.location = b.attr('href'); }
                else { b.trigger('click'); }
            }
        }
    });
});
0
Martin
Telerik team
answered on 17 Sep 2012, 04:49 PM
Hello Marc Messer,

I have addressed the support ticket you have opened on the same topic. To make my post available for our community I am pasting it here as well:

Just to clarify that we do not need s stripped version of your CMS application. All we need is just a sample page that replicates the issue.

Indeed as my colleague Vasil confirmed, we had released this issue in a previous version of the controls. After it was reported and before it was fixed, our devs came with a
temporary solution. This was an override of one of the internal RadInputControl functions. However this temporary solution is not needed for versions after Q2 2012 SP1 (2012.2.724) because a stable fix was included in the source code.

Based on the above, the default button should work as expected in IE8
without any additional code for versions after the one specified above. In this case any custom code added to page that affects this functionality is sole developer's responsibility and is not supported.


I hope this helps.

Regards,
Martin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Input
Asked by
Hunter
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Hunter
Top achievements
Rank 1
Shukhrat Nekbaev
Top achievements
Rank 1
Chris Dalessandri
Top achievements
Rank 1
Marc Messer
Top achievements
Rank 2
Martin
Telerik team
Share this question
or