Disable Validation in Dojo datetextbox - dojo

Is there a way to turn off or disable client site validation in dojo's form widget datetextbox. I would like users to be able to type the date in if they want and support most common date formats

Your question is not quite clear at "disable client site validation". If I understand you correct, you are asking to be able input any value manually and also be able to use date dropdown pickup.
There is an _isInvalidDate method you can try to overwrite like:
new DateTextBox({
value: "31-DEC-2009",
name: "oracle",
_isInvalidDate: function(){return false;}
onChange: function(v){ }
}, "oracle");
Since this is an internal(private) method, it is not suggested but may work.
There is another method you can feel free to overwrite to use your own validation Regexp in constrints:
validator: function(/*anything*/ value, /*__Constraints*/ constraints){

Related

Keyboard shortcuts on Flutter web

I'm adding keyboard shortcuts to a Flutter web application.
I have a form within a custom FocusableActionDetector where the shortcut has form like this:
SingleActivator(LogicalKeyboardKey.digit2)
and action is like:
CustomActivateIntent: CallbackAction<CustomActivateIntent>(
onInvoke: (intent) { provider.value = "2"; },)
In the same form I have a couple of numeric TextFormFields. To permit writing the character "2" I have to put these text fields inside some new FocusableActionDetector, otherwise the previous detector catches the command and the text field loses the "2" character, and this is already quite weird... Moreover, after writing in any of the text fields the form focus detector doesn't work anymore.
I think this could be related to the focus system, which is yet not that clear to me.
Can anyone help find a clean solution?
I found a workaround: the FocusableActionDetector is now preceded by an if statement. The code looks like the following:
// I extract the form to a widget to make it clearer
var searchWidget = SearchWidget();
child: textEditingInProgress
? searchWidget
: FocusableActionDetector(
child: searchWidget,
...,
),
The textEditingInProgress bool is a field in a provider and is controlled by the FocusNodes belonging to the TextControllers.
Still this is not a perfect solution, in particular I'd like to understand why the previous approach was not working.

Access data value from vue-hotel-datepicker

I am using vue-hotel-datepicker and after I select a date range I want to get that value, but I am not sure how. I tried several methods, but no good.
<HotelDatePicker
#toggleDatepicker="getDate" // that's how I try to get the value, but is not workign
></HotelDatePicker>
methods: {
getDate(index) {
console.log("i:", index); /I don't get here
},
}
Also I am not sure if toggleDatepicker is good, I didn't find in documentation how can I get that value. Also if I want to use a v-model to get that value, I get "true", "false"
According to the documentation of your plugin, you have to listen to plugin events. So you can replace #toggleDatepicker by #booking-clicked.
# if for event listening, so you have to check the event section of the plugin.
According to the documentation, toggleDatePicker isn't an event, but a method. You can try using the check-in-changed and check-out-changed events, or check out the other event options (however, I think these will fit your use case).

Add target blank to a link in a props in Vue.js

I use the ReadMore plugin to crop articles in a page. The plugin provides a props to redirect to a http link when the "read more" is clicked. But I need to display the link in a new tab. The props receives the link in a string.
I tried several ways to add the target blank attribute to this string before passing it to the props. With no success. Like:
http://www.example.com/page-to-see.html target=_"blank"
I used it with or without quotes but in any case, the link works but the attribute is skipped.
Is there a way to intercept this and add a target blank later?
I saw in other questions the use of router-link but I don't know how to manipulate the props content in the first place.
Any clue would be warmly welcomed
Edit: adding more code to give a clearer explanation of the problem I try to solve:
In the template:
<read-more more-str="read more" :text="dwId.texte" :link="dwId.link" less-str="less" :max-chars="540"></read-more>
I get the values from a DB with Axios. The props are specified by the plugin documentation.
The :link must be a string and it's what it gets from the DB. It works. But as I explained, I need to open in a new tab.
Edit: what I tried:
I try to make a computed property that would add the target blank to a string and use it in the read-more props:
computed: {
target: function() {
return this.dwIds.filter((dwId) => {
return dwId.link + target="_blank"
});
},
}
I have two issues here: first , the result is an object and the props requires a string. Furthermore, the way I add the target blank is not correct but I can't find the right syntax yet.
You need to use it as a directive, and override parts of the initial element you're passing. Otherwise there is no way to "intercept" it. Here's the code to the "component" version that won't do the trick for you.

angularJS dynamic login page

My code is here: http://plnkr.co/edit/2WDK0b
Is it possible that when I enter an existing username, the message in the "help-block" span will change dynamically?
Just wrap your existing checking code in a function in the controller. Like $scope.checkUsername = function() { //your existing code }
Now on your username input put ng-change="checkUsername()" and then it will work.
Before you get too much further make sure to read the validation bits from the Angular Form's guide: http://docs.angularjs.org/guide/forms
Here's a fiddle of your code working: http://plnkr.co/edit/LwMJGq?p=preview Although I think the logic for the name checking needs a bit of work.

Extjs4 Combo's and Stores: Remove filter when queryMode=local?

I'm getting frustrated because my store keeps getting filtered whenever I use it to back a combofield. Is there any way I can disable this?
The Scenario
I have a Store with a data field on it; an array of objects loaded when the store is instantiated. I use this store to drive a bunch of combo's in different areas of my app. Unfortunately, my combos are applying filters on the store, causing other combos using the same store to only display the filtered values later on, not the whole list.
Workarounds
My goofy workaround is to call combo.getStore().clearFilter() after I'm done with the combo, but that's going to get old very quick, and probably introduce a bug somewhere, I'm sure.
If I remove queryMode:'local' from my combo's config, all is well, except that now the handy type-ahead feature no longer works; I'm just shown a list of items in a drop-down that I can't even navigate around my typing letters of matching items. That's worse than a regular html select tag!
Any ideas?
Thanks!
You can't do that since the filtering is applied not on the combo but on the store. You could try creating multiple instances of the same store and work with that. Though I don't know if it'll work.
Ext.create('combo', {
//other config
store : Ext.create('my.store')
});
It'll work if you make the combo non-editable since no filtering can be applied then. But, as you say, you need the type ahead feature, you'll need to create multiple instances of the store.
In light of the fact that combos will add filters on the backing store, hence affecting all combos that use the store within my application, I've opted to add an override to the combo class so it will clear the filter on the store when the combo box is destroyed.
Ext.define('MAP.override.Combo', {
override : 'Ext.form.field.ComboBox',
initComponent : function()
{
this.callParent(arguments);
this.on('beforedestroy',function(combo){
if(combo.leaveFilter === true) return;
console.log('clearing filter on store');
combo.getStore().clearFilter();
});
}
});
it's a bit of a hack, but I do allow for the escape hatch of indicating not to clear the filters, too.
The simplest way I have found to handle this solution is to add the following listener to the combo:
listeners: {
beforequery: function(queryPlan){
queryPlan.query = true;
}
}
by default queryPlan.query is the text currently in the combo field which is used for filtering. Setting it to false cancels the query, but setting it to true allows the query to go through without a filter value, therefore keeping all values in the drop down list for all combo fields.
I've had similar problem with ExtJS 4.2 and combo. Store kept being filtered but I couldn't use clearFilter() because after that combo was unusable. My solution, which worked, is this listener on combo:
listeners: {
blur: function(combo) {
if (combo.queryFilter) {
combo.queryFilter.setValue('');
combo.getStore().filter();
}
}
}