mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +00:00
Fix formValidation on creating attribute
This commit is contained in:
parent
f4b4811148
commit
45ecbb8591
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
/* eslint-disable new-cap */
|
/* eslint-disable new-cap */
|
||||||
|
|
||||||
import { includes, map , forEach, replace } from 'lodash';
|
import { concat, includes, map, forEach, replace } from 'lodash';
|
||||||
import { Map, List } from 'immutable';
|
import { Map, List } from 'immutable';
|
||||||
import { getValidationsFromForm } from '../../utils/formValidations';
|
import { getValidationsFromForm } from '../../utils/formValidations';
|
||||||
import { storeData } from '../../utils/storeData';
|
import { storeData } from '../../utils/storeData';
|
||||||
@ -153,7 +153,8 @@ export function setAttributeForm(hash) {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
const attribute = includes(hash, 'attributerelation') ? attributeRelation : data.attribute;
|
const attribute = includes(hash, 'attributerelation') ? attributeRelation : data.attribute;
|
||||||
const formValidations = getValidationsFromForm(data.form, []);
|
const formValidations = concat(getValidationsFromForm(data.form, []), { target: 'name', validations: { required: true } });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: SET_ATTRIBUTE_FORM,
|
type: SET_ATTRIBUTE_FORM,
|
||||||
form: data.form,
|
form: data.form,
|
||||||
|
@ -127,6 +127,7 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
|
|||||||
}
|
}
|
||||||
|
|
||||||
addAttributeToContentType = () => {
|
addAttributeToContentType = () => {
|
||||||
|
console.log(this.props.formValidations);
|
||||||
const formErrors = this.checkAttributeValidations(checkFormValidity(this.props.modifiedDataAttribute, this.props.formValidations));
|
const formErrors = this.checkAttributeValidations(checkFormValidity(this.props.modifiedDataAttribute, this.props.formValidations));
|
||||||
|
|
||||||
if (!isEmpty(formErrors)) {
|
if (!isEmpty(formErrors)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user