How to remove rules message when other event is triggered - vue.js

How to remove rules message when other event is triggered
return {
'first_name': [
{
required: !this.form.gender,
message: this.form.gender ? '' : Field can not be empty',
trigger: 'blur',
}
],
'last_name': [
{
required: !this.form.gender,
message: 'Field can not be empty',
trigger: 'blur',
}
]
}
If gender is true then messge should be blank how can i achieve this. What currently is working it remove the required asterisk but did not remove message since it will only work when blur trigger. I don't want either it should remove message to if gender is true please guide thanks

Related

i am trying to use a drop down in table but when i try to open i can't see the list and also on keydown list values are changing

my html code is:
<p-dropdown id="ddlMappingProducts" [appendTo]="'body'"
[style]="{'min-width': '100px','color':'white', 'border-bottom':'2px solid white', 'background-color':'white'}"[options]="booleanOptions"
optionLabel="label">
</p-dropdown>
booleanOptions = [
{ label: "true", value: "true" },
{ label: "false", value: "false" }
]
by default
on key down
how can i solve this... can anyone please help

Vue js [Vue warn]: Duplicate keys detected:

Hello I know what is the problem but I don't know how to solve it. Please help.
I am generating input fields and text area fields, so I have 2 v-fors(I will and third one too)
<div v-for="(textarea, textareaId) in blog.textareas" :key="textareaId">
<div v-for="(sectionTitle, sectionTId) in blog.sectionTitles" :key="sectionTId">
blog:{
blogTitle: '',
images: [
{
imagesId: 0,//this was called id
name: ''
}
],
sectionTitles:[
{
sectionTId: 0,//this was called id
title: ''
},
],
textareas: [
{
textareaId:0, //this was called id
text: ''
},
]
},
I have tried to change ids to not be all three 0 but I keep getting a warning evert time I enter the same number to :key="id"
Duplicate keys detected: '1'
Duplicate keys detected: '2'
and so on.
:key="'textarea_'+textareaId" and for sectionTitles :key="'section_'+sectionTId"

How to use $t from vue-i18n inside Vuex store to initialize static strings

In my vuex store module I have provinceData to supply as datasource for Vuetify dropdown selection box.
provinceData: [
{value:"AB", text: "Alberta"},
{value:"BC", text: "British Columbia"},
...
],
I can import i18n from '../plugins/i18n' and confirm in console output that i18n.t('province.BC') return me proper text from resource files
i18n.t('province.BC') British Columbia
click onLanguageChange fr
i18n.t('province.BC') British Columbia (Fr)
But how I can insert these translations into datasource?
provinceData: [
{value:"AB", text: ???i18n.t('province.AB')??? },
{value:"BC", text: ???i18n.t('province.BC')??? },
...
]
Now I realized what mistake I did by wrapping i18n.t('province.AB') into back ticks. Here is corrected version which render english only messages:
provinceData: [
{value:"AB", text: i18n.t('province.AB') },
{value:"BC", text: i18n.t('province.BC') },
...
]
Moreover, will it be reinitialized if I switch the current locale?
PS. When getter for this datasource is hit I can see that message retrieved according to current locale. But dropdown box izn't reloaded. That's the problem
Following getter print correct translation every time it called:
provinceData: (state) => {
console.log("i18n.t('province.BC')",i18n.t('province.BC'));
return state.provinceData;
},
Because the provinceData inside the store it can't be modified by anything but mutators.
So I decided to create this array right in the getter and it turns out to be quite fast.
provinceData: ( state ) =>
{
const provinceData = [ "AB", "BC", "MB", "NB", "NF", "NT", "NS", "NU", "ON", "PE", "QC", "SK", "YT" ];
let provinces = [];
provinceData.forEach( (province) => {
provinces.push
({
value : province,
text : i18n.t( 'province.'+province )
})
})
return provinces;
}

what is the proper way to validate all elements of an array in the query parameters even with 1 element with express-validator?

Using express-validator version 5.3.0.
I love the new syntax and I want to validate that a query parameter is valid. That parameter can be an array (as in repeat parameter).
The issue I have is that when only 1 element is passed, the framework seems to just consider it a string and the error message(s) is(are) a bit cumbersome.
with this configuration:
checkSchema([
{
foo: {
in: 'query',
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo'
}
}])
with the url http://server/api?foo=bar&foo=not bar I get the following error:
{
"location": "query",
"param": "foo[1]",
"value": "not bar",
"msg": "Invalid foo"
}
which seems correct.
However with the url http://server/api?foo=not bar I get the following error:
{
"location": "query",
"param": "foo[3]",
"value": " ",
"msg": "Invalid foo"
}
It's not a huge deal, but the foo[3] param is a bit misleading as technically is either just foo or foo[0].
I tried with isArray: true like below, but no luck:
foo: {
in: 'query',
isArray: true,
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo',
},
But that seems to actually ignore the second foo parameter (because technically a string is an array of characters?).
And with the single parameter version foo=no bar it shows the error message twice (I assume because the validator fails for both isArray and isAlphanumeric?)
Alright, so, it looks like express-validator was updated since then and now provides a toArray sanitizer.
So now, I can write the following:
checkSchema([
{
foo: {
in: 'query',
optional: true,
toArray: true,
},
'foo.*': {
in: 'query',
isAlphanumeric: true,
optional: true,
errorMessage: 'Invalid foo'
}
}])
And as an added bonus, it will now always convert queries with 1 parameter to an array of 1 value.

Sencha Touch Cannot call method 'substr' of null on Loacations:10

Hi as the Title says i am getting this error suddenly without changing anything.
This is the File Locations Code:
Ext.define('Wickelplaetze.store.Locations', {
extend: 'Ext.data.Store',
requires: 'Wickelplaetze.model.Location',
config: {
model: 'Wickelplaetze.model.Location',
storeId: 'locationsstore',
grouper: {
groupFn: function(record) {
return record.get('ort').substr(0, 1);
},
sortProperty: 'ort'
},
proxy: {
type: 'ajax',
url: 'http://freakp.com/wpapp/form-data.json',
withCredentials: false,
useDefaultXhrHeader: false
},
autoLoad: true
}
});
There are null values in you json for key ort. You can check if ort is not null and then return like -
if(record.get("ort")!= null){
return record.get('ort')[0];
}
Will remove that error doing so. But this will not sort records properly.
One more thing, if you want to sort list by first letter of ort , you can directly use -
return record.get("ort")[0];
When I tried your code to populate list, its actually running infinitely. I didn't get anything. Sorting these much values is damn slow. It took 3 mins to populate the list.
UPDATE
Link for working fiddle for your example. You can see null values at bottom of list. There are 7 null values for key ort.