Skip to content
Snippets Groups Projects
Commit 6921aecc authored by Stephanie Briere Americo's avatar Stephanie Briere Americo
Browse files

Merge branch 'issue/38' into 'development'

Issue #38: Regexes Update

See merge request !36
parents ee89cd40 479fe120
Branches
No related tags found
3 merge requests!58Version 1.1,!54Issue #53: Fix password info,!36Issue #38: Regexes Update
...@@ -26,6 +26,7 @@ const useStyles = makeStyles((theme) => ({ ...@@ -26,6 +26,7 @@ const useStyles = makeStyles((theme) => ({
}, },
title: { title: {
fontSize: "x-large", fontSize: "x-large",
lineHeight: "normal",
}, },
description: { description: {
fontSize: "large", fontSize: "large",
...@@ -60,6 +61,7 @@ function FormFieldText(props) { ...@@ -60,6 +61,7 @@ function FormFieldText(props) {
input: classes.title, input: classes.title,
}, },
}} }}
InputLabelProps={classes.test}
/> />
{props.error ? ( {props.error ? (
<Grid className={classes.errorGrid}> <Grid className={classes.errorGrid}>
......
...@@ -8,9 +8,7 @@ function checkText(value) { ...@@ -8,9 +8,7 @@ function checkText(value) {
/** Function that applies the validation of it's used schema and sets the error messages. */ /** Function that applies the validation of it's used schema and sets the error messages. */
export async function testQuestionTextSchema(error, value) { export async function testQuestionTextSchema(error, value) {
value value
? checkText(value)
? (error.errorMsg.question = "") ? (error.errorMsg.question = "")
: (error.errorMsg.question = "O caractere não é permitido")
: (error.errorMsg.question = "Este campo é obrigatório!"); : (error.errorMsg.question = "Este campo é obrigatório!");
} }
/** Function that applies the validation of it's used schema and sets the error messages. */ /** Function that applies the validation of it's used schema and sets the error messages. */
...@@ -73,9 +71,7 @@ export async function testSubformSchema(form, index) { ...@@ -73,9 +71,7 @@ export async function testSubformSchema(form, index) {
/** Function that applies the validation of it's used schema and sets the error messages. */ /** Function that applies the validation of it's used schema and sets the error messages. */
export async function selectOptionTextTesting(error, value, idopt) { export async function selectOptionTextTesting(error, value, idopt) {
value value
? checkText(value)
? (error.errorMsg.options[idopt] = "") ? (error.errorMsg.options[idopt] = "")
: (error.errorMsg.options[idopt] = "O caractere não é permitido")
: (error.errorMsg.options[idopt] = "Por favor, preencha esta opção"); : (error.errorMsg.options[idopt] = "Por favor, preencha esta opção");
} }
/** Schema to validate the quantity field of the validation from FormFieldText. */ /** Schema to validate the quantity field of the validation from FormFieldText. */
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
selectOptionsTesting, selectOptionsTesting,
testSubformSchema, testSubformSchema,
selectOptionTextTesting, selectOptionTextTesting,
testTextValidation testTextValidation,
} from "../components/fieldsDisplayForm/utils/schemas"; } from "../components/fieldsDisplayForm/utils/schemas";
import { import {
pushTitle, pushTitle,
...@@ -16,7 +16,7 @@ import { ...@@ -16,7 +16,7 @@ import {
pushSelect, pushSelect,
pushRadio, pushRadio,
pushCheckbox, pushCheckbox,
pushSubform pushSubform,
} from "../components/fieldsDisplayForm/utils/FormComposition"; } from "../components/fieldsDisplayForm/utils/FormComposition";
import api from "../api"; import api from "../api";
...@@ -148,7 +148,6 @@ const useForm = () => { ...@@ -148,7 +148,6 @@ const useForm = () => {
*/ */
async function setDescriptionField(value, index) { async function setDescriptionField(value, index) {
form[index].description = value; form[index].description = value;
testDescriptionTextSchema(form[index].error, value);
setForm([...form]); setForm([...form]);
} }
...@@ -248,13 +247,13 @@ const useForm = () => { ...@@ -248,13 +247,13 @@ const useForm = () => {
"question", "question",
"description", "description",
"options", "options",
"subformId" "subformId",
]) !== ]) !==
JSON.stringify(form[j], [ JSON.stringify(form[j], [
"question", "question",
"description", "description",
"options", "options",
"subformId" "subformId",
]) || ]) ||
differentValidation(backForm[i], form[j]) differentValidation(backForm[i], form[j])
) { ) {
...@@ -279,8 +278,8 @@ const useForm = () => { ...@@ -279,8 +278,8 @@ const useForm = () => {
const post_response = await api const post_response = await api
.put(`/form/${routeId}`, data, { .put(`/form/${routeId}`, data, {
headers: { headers: {
authorization: `bearer ${window.sessionStorage.getItem("token")}` authorization: `bearer ${window.sessionStorage.getItem("token")}`,
} },
}) })
.then(function (error) { .then(function (error) {
if (!error.response) { if (!error.response) {
...@@ -307,8 +306,8 @@ const useForm = () => { ...@@ -307,8 +306,8 @@ const useForm = () => {
const post_response = await api const post_response = await api
.post(`/form`, await createBackendForm(form), { .post(`/form`, await createBackendForm(form), {
headers: { headers: {
authorization: `bearer ${window.sessionStorage.getItem("token")}` authorization: `bearer ${window.sessionStorage.getItem("token")}`,
} },
}) })
.then(function (error) { .then(function (error) {
if (!error.response) { if (!error.response) {
...@@ -343,7 +342,7 @@ const useForm = () => { ...@@ -343,7 +342,7 @@ const useForm = () => {
setValidationValue, setValidationValue,
removeValidation, removeValidation,
onDragEnd, onDragEnd,
submit submit,
}; };
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment