escape square brackets with formik The 2019 Stack Overflow Developer Survey Results Are InReact Native + Formik: setFieldTouched does not workFormik & yup form validation not working as expected with VirtualizedSelectFormik validation not working for my custom react-places-autocomplete componentFormik + yup not displaying errorsTrying to understand how formik package for react is constructedPassing state from modal's form to props of parent form (Formik)React | Formik Async Validatin, cannot read .then of undefinedField's Formik bag empty when nested in third party componentHow to show error only if Field is touched? | React && FormikDownshift autocomplete onBlur resetting value with Formik
If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?
Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?
Is it okay to consider publishing in my first year of PhD?
Loose spokes after only a few rides
Keeping a retro style to sci-fi spaceships?
Is it safe to harvest rainwater that fell on solar panels?
What is this sharp, curved notch on my knife for?
Match Roman Numerals
How to display lines in a file like ls displays files in a directory?
How can I define good in a religion that claims no moral authority?
How come people say “Would of”?
Can there be female White Walkers?
Why doesn't UInt have a toDouble()?
Is one supposed to eat the zero'ah (shank bone) from the Seder plate?
Inverse Relationship Between Precision and Recall
I am an eight letter word. What am I?
If a sorcerer casts the Banishment spell on a PC while in Avernus, does the PC return to their home plane?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
What is the meaning of Triage in Cybersec world?
What do hard-Brexiteers want with respect to the Irish border?
Will it cause any balance problems to have PCs level up and gain the benefits of a long rest mid-fight?
Does adding complexity mean a more secure cipher?
Can we generate random numbers using irrational numbers like π and e?
Worn-tile Scrabble
escape square brackets with formik
The 2019 Stack Overflow Developer Survey Results Are InReact Native + Formik: setFieldTouched does not workFormik & yup form validation not working as expected with VirtualizedSelectFormik validation not working for my custom react-places-autocomplete componentFormik + yup not displaying errorsTrying to understand how formik package for react is constructedPassing state from modal's form to props of parent form (Formik)React | Formik Async Validatin, cannot read .then of undefinedField's Formik bag empty when nested in third party componentHow to show error only if Field is touched? | React && FormikDownshift autocomplete onBlur resetting value with Formik
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm using Formik in react and I'm having issues with square brackets when using the validation in order to show errors on screen. I tried with "[" but it didn't work. Insted using something like "text" or "text-i" or even "text(i)" works fine, but I'm having problems only with square brackets.
isDataValid = (values: KeyValue<any>) => {
let errors: FormikErrors<KeyValue<any>> = ;
(for let i=0; i<... etc)
if (!values["text[i]"])
errors["text[i]"] = "Insert title";
return errors;
Any tips?
reactjs formik
add a comment |
I'm using Formik in react and I'm having issues with square brackets when using the validation in order to show errors on screen. I tried with "[" but it didn't work. Insted using something like "text" or "text-i" or even "text(i)" works fine, but I'm having problems only with square brackets.
isDataValid = (values: KeyValue<any>) => {
let errors: FormikErrors<KeyValue<any>> = ;
(for let i=0; i<... etc)
if (!values["text[i]"])
errors["text[i]"] = "Insert title";
return errors;
Any tips?
reactjs formik
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24
add a comment |
I'm using Formik in react and I'm having issues with square brackets when using the validation in order to show errors on screen. I tried with "[" but it didn't work. Insted using something like "text" or "text-i" or even "text(i)" works fine, but I'm having problems only with square brackets.
isDataValid = (values: KeyValue<any>) => {
let errors: FormikErrors<KeyValue<any>> = ;
(for let i=0; i<... etc)
if (!values["text[i]"])
errors["text[i]"] = "Insert title";
return errors;
Any tips?
reactjs formik
I'm using Formik in react and I'm having issues with square brackets when using the validation in order to show errors on screen. I tried with "[" but it didn't work. Insted using something like "text" or "text-i" or even "text(i)" works fine, but I'm having problems only with square brackets.
isDataValid = (values: KeyValue<any>) => {
let errors: FormikErrors<KeyValue<any>> = ;
(for let i=0; i<... etc)
if (!values["text[i]"])
errors["text[i]"] = "Insert title";
return errors;
Any tips?
reactjs formik
reactjs formik
asked Mar 8 at 10:53
J.DoeJ.Doe
132
132
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24
add a comment |
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24
add a comment |
1 Answer
1
active
oldest
votes
Not utilising i seems to be the issue. In-order to use i within for loop in this case, you can make use of template literals, or +.
Using template literals :
(for let i=0; i<... etc)
if (!values[`text[$i]`])
errors[`text[$i]`] = "Insert title";
Using +:
(for let i=0; i<... etc)
if (!values["text[" + i + "]"])
errors["text[" + i + "]"] = "Insert title";
Please note the use of template literals may result compatibility issues, refer: https://caniuse.com/#feat=template-literals
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061679%2fescape-square-brackets-with-formik%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not utilising i seems to be the issue. In-order to use i within for loop in this case, you can make use of template literals, or +.
Using template literals :
(for let i=0; i<... etc)
if (!values[`text[$i]`])
errors[`text[$i]`] = "Insert title";
Using +:
(for let i=0; i<... etc)
if (!values["text[" + i + "]"])
errors["text[" + i + "]"] = "Insert title";
Please note the use of template literals may result compatibility issues, refer: https://caniuse.com/#feat=template-literals
add a comment |
Not utilising i seems to be the issue. In-order to use i within for loop in this case, you can make use of template literals, or +.
Using template literals :
(for let i=0; i<... etc)
if (!values[`text[$i]`])
errors[`text[$i]`] = "Insert title";
Using +:
(for let i=0; i<... etc)
if (!values["text[" + i + "]"])
errors["text[" + i + "]"] = "Insert title";
Please note the use of template literals may result compatibility issues, refer: https://caniuse.com/#feat=template-literals
add a comment |
Not utilising i seems to be the issue. In-order to use i within for loop in this case, you can make use of template literals, or +.
Using template literals :
(for let i=0; i<... etc)
if (!values[`text[$i]`])
errors[`text[$i]`] = "Insert title";
Using +:
(for let i=0; i<... etc)
if (!values["text[" + i + "]"])
errors["text[" + i + "]"] = "Insert title";
Please note the use of template literals may result compatibility issues, refer: https://caniuse.com/#feat=template-literals
Not utilising i seems to be the issue. In-order to use i within for loop in this case, you can make use of template literals, or +.
Using template literals :
(for let i=0; i<... etc)
if (!values[`text[$i]`])
errors[`text[$i]`] = "Insert title";
Using +:
(for let i=0; i<... etc)
if (!values["text[" + i + "]"])
errors["text[" + i + "]"] = "Insert title";
Please note the use of template literals may result compatibility issues, refer: https://caniuse.com/#feat=template-literals
answered Mar 9 at 14:32
Dani VijayDani Vijay
194317
194317
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061679%2fescape-square-brackets-with-formik%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you provide more context?
– Dani Vijay
Mar 9 at 14:24