How disable handlers of Bootstrap Datepicker which delete value when "delete" key pressed? - bootstrap-datepicker

From manual:
https://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds
'delete': function () {
this.clear();
}
I try to disable handler:
keyBinds: {'delete': function() {} }
But it's don't effect.
How make when "delete" key pressed, clear only one symbol from cursor?

Use null value instead of function.
keyBinds: {
'delete':null
}

Related

QML Keyboard Shortcut Click Button

I am trying to add a keyboard shortcut to my QML but I am having a hard time getting it working without repeating logic. Below is the code,
Controls.Button {
id:sendAction
Shortcut {
sequence: "Ctrl+Return"
onActivated: parent.trigger()
}
onPressed: {call function}
}
If I repeat the calling of the function, the keyboard shortcut works but with parent.trigger() it fails with trigger isn't a property of the button. I have tried looking up what functions can be called in a shortcut to trigger the parent but the documentation is quite light. Essentially what I need though is what to add in to onActivated to trigger the onPressed without repeating the function call.
have you tried the pressed signal?
onActivated: parent.pressed()
https://doc.qt.io/qt-5/qml-qtquick-controls2-abstractbutton.html#pressed-signal
Solved with the code below.
Item {
Shortcut{
id: sendShortcut
sequences: ["Ctrl+Enter", "Ctrl+Return"]
onActivated: sendAction.action.trigger()
}
}
Controls.Button {
id:sendAction
action: Controls.Action {
onTriggered{
call function
}
}
onPressed: action.trigger()
}

How to disable Cascading Dropdown with selected value?

While updating record, I want to disable ajax Cascading drop down with selected value.
How can I achieve this?
To disable the dropdown you could add a the following snippet of client-side code;
function DisableDDL() {
$('#<%= ddlName.ClientID %>').attr('disabled', 'disabled');
}
function PageLoad(sender, args) {
$find("ddlName").add_populated(DisableDDL);
}

How to Hide linkButton inasp.net when value=0?

I want to disable linkbutton when I found value=0 in asp.net and want to visible label with 0 value.
You can add some JS Code at the javasccript pageLoad that loops all link buttons using CssClass(add dummy css class if not exists).
function pageLoad() {
$('.lbClassName').each(function (item) {
if ($(item).val() == '0') {
$(item).prop('disabled', true);
}
})
}

removing validation attributes conditionally

i have a panel which iam showing as pop up with few textbox controls with several validation controls and button on clicking which i am checking for validation now i want to add a checkbox on checking it it should disable some of the controls and remove the validation properties from them and on unchecking it apply the same i am able to make those controls disabled but still on clicking that button it is asking for validating those controls
on the click event of checkbox i am calling one javascript function and applying the disabled attribute to some of the controls
function disableOtherElements(e)
{
var id = e.checked;
if (id)
{
$('.dd').attr('disabled', true);
}
else
{
$('.dd').removeAttr('disabled');
}
}
dd is the class assigned to all the controls that i want to be disabled.
what i have to do to remove the validation properties
One way to achieve that would be to use the client-side API exposed by the ASP.NET validators.
First, you'll have to iterate over Page_Validators to locate all the validators that target your elements, then use ValidatorEnable() to enable or disable validation:
function enableValidation(element, enable)
{
$.each(Page_Validators, function() {
if (this.controltovalidate == element.id) {
ValidatorEnable(this, enable);
}
});
}
function disableOtherElements(e)
{
if (e.checked) {
$('.dd').each(function() {
enableValidation(this, false);
}).attr('disabled', true);
} else {
$('.dd').each(function() {
enableValidation(this, true);
}).removeAttr('disabled');
}
}

Calling my own function during with onClick

How do I call a user-define function such as this one using the onClick attribute of a input button? More specifically what special steps must I take in JQuery and what would the HTML markup look like? Thanks
function simClick(keyCode) {
var e = jQuery.Event("keypress");
e.keyCode = 8;
$(document).trigger(e);
}
<input type="button" ID="delBtn" class="calcBtn" value="Del" onclick="???????" />
HTML
<input type="button" ID="delBtn" class="calcBtn" value="Del" />
Javascript in separate file
// When the DOM is ready
$(function() {
// Function that is executed w keypress or button click
doThis = function() {
// Stuff to do
}
// To do when element with ID delBtn is clicked
$("#delBtn").click(function() {
// Stuff to do when input is clicked
doThis();
});
// To do when key is pressed
$(document).keydown(function(event) {
// Stuff to do when key is pressed
// Can check which key was pressed here.
var code = (event.keyCode ? event.keyCode : event.which);
if(code == 8) { //Enter keycode
doThis();
}
});
});
There are many ways to attach a handler to when that button is clicked. Take a look at jQuery selectors.
You could also use the attribute equals selector
$("input[value='Del']")...... // For the input with a value of Del
I'm not sure what you quoted JS has to do with the input button, since it looks like you're trying to work with a keypress instead of a click in that function.... But the above jQuery is how you capture a click on that input button.
Take a look at, "Which key was pressed?"

Resources