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

Disabling anchor tag button

1 Answer 441 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Russ
Top achievements
Rank 1
Russ asked on 21 Oct 2013, 01:42 PM
I have a view that has a navigation button to another view that looks like this:
<a id="GoIssue" data-role="button" href="Main/Issue?priorPage=Picklist&fieldName=reqOrWO&value={TBS}" data-icon="details" ></a><br>

I'd like to disable it under certain conditions.   I have tried adding a class to it and checking the class in the click handler:
//  Start disabled until someone puts something IN the reqOrWO field
$('#GoIssue').addClass("disabled");
 
//  disabled is implemented by returning false on the click action if it has the disabled class
//  the disabled class also has visual aspects as well.
$('#GoIssue').click(function ()
    {
        event.preventDefault ? event.preventDefault() : event.returnValue = false;
        return (!$(this).hasClass('disabled'));
    });
At first, I just tried returning false, but navigation still occurred.  So, I tried adding the additional code to call preventDefault() [if present] and event.returnValue [if not].  But none of this seems to prevent the navigation from going to the target page.

Am I missing something?  Is there a simpler way?

Thanks

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 23 Oct 2013, 07:28 AM
Hello Russell,

Unfortunately enable/disable functionality of the Kendo UI Mobile Button is not supported at the moment. But please take a look at the following blog post, discussing a similar problem and a possible resolution:

http://www.kendoui.com/forums/kendo-ui-mobile/button/enable-disable-kendo-ui-mobile-button.aspx

If you want to prevent the clicking of the button, you can use the data-click attribute and handle the event parameter there (e.preventDefault).
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
General Discussions
Asked by
Russ
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or