This topic contains 2 replies, has 3 voices, and was last updated by Sean Sean 2 years, 8 months ago.

problem in Material Design Form Controls with error validation


  • masteryo
    Participant

    Member Reply #1497

    Hi , I’m using Material Design Form Controls , I want when I press on submit button, show all error fields as red color.

    Currently I have to press on each field to see if there is error or not


    sworden
    Participant

    Posts: 1
    Member Reply #1502

    I just ran into this same issue about an hour ago…Their code is set to do just that for some reason in a porly written function in metronic.js.  You need your input / form elements to have class edited added to them after validation, blur, etc. so something like the following will work in a doc ready.

    $('form').on('keyup, blur', '.form-control', function() {

    $(this).addClass('edited');

    });

    $('form').submit(function() {

    $('.form-control').addClass('edited');

    });

    I don’t know why they make you add class edited.  Google doesn’t require this in their material nor do any other material themes. I personally think this should be removed.  This just adds unnecessary complexity for no reason like a lot of items in this theme do.

    Sean
    Sean
    Keymaster

    Posts: 4206
    Support Staff Reply #1531

    Hi @sworden,

    Thanks for sharing your solution. We will check this further and improve it in the next update very soon.

    Thanks.

You must be logged in to reply to this topic.