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;








0















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?










share|improve this question






















  • Can you provide more context?

    – Dani Vijay
    Mar 9 at 14:24

















0















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?










share|improve this question






















  • Can you provide more context?

    – Dani Vijay
    Mar 9 at 14:24













0












0








0








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?










share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 10:53









J.DoeJ.Doe

132




132












  • 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





Can you provide more context?

– Dani Vijay
Mar 9 at 14:24












1 Answer
1






active

oldest

votes


















0














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






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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






    share|improve this answer



























      0














      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






      share|improve this answer

























        0












        0








        0







        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






        share|improve this answer













        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







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 9 at 14:32









        Dani VijayDani Vijay

        194317




        194317





























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

            Алба-Юлія

            Захаров Федір Захарович