This topic contains 6 replies, has 3 voices, and was last updated by Sean Sean 1 week, 3 days ago.

Using the new "repeater" with validation


  • h85jbkNqPLoYViY
    Participant

    Posts: 2
    Member Reply #7706

    Hi Guys,

    Nice to see you have added the Form Repeater to the latest release. It came at a great time as I needed exactly that for the project I’m working on.

    The problem I have though is how to implement validation of the “repeated” form fields. jQuery validator doesn’t like me setting rules like “group-c[][product_id]”.

    Can you point me in the right direction?

    Thanks for the awesome work you have done on the admin theme templates and all the features they have!

    Jay


    h85jbkNqPLoYViY
    Participant

    Posts: 2
    Member Reply #7707

    Hi Guys,

    Ignore the above, I’ve sorted it.

    The solution is to loop through the cloned form elements and dynamically add rules for each of the required fields (https://jqueryvalidation.org/rules/#.22add.22rules). This is done in the “form-repeater.js” when the block/elements are cloned.

    I only needed to set a couple of my cloned fields to “required” so had to iterate over the fields to find the correct ones to set the additional rules.

    Could be worth you guys doing a demo/example on the Form Repeater page 🙂

    HTH,

    Jay

    Sean
    Sean
    Keymaster

    Posts: 4056
    Support Staff Reply #7718

    Great! Thanks for sharing this idea. We will add some advance usage of the form repeater plugin including form validation examples in a future updates. Stay tuned! 🙂


    h85jbkNqPLoYViY
    Participant

    Posts: 2
    Member Reply #7720

    Thanks Sean!

    Will keep a look out. Will be interesting to see how you guys implement the solution 🙂

    Cheers,

    Jay

    Sean
    Sean
    Keymaster

    Posts: 4056
    Support Staff Reply #7723

    Sure. We will attend to this as soon as possible 🙂


    nigelbogle
    Participant

    Posts: 6
    Member Reply #13112

    Hi Guys,

    I’d like to add my appreciation for all your hard work on the theme.  I’m also having an issue with validation here and it’s taking so very long to figure out.

    Any chance of a snippet to show your supporters how to achieve validation on controls inside the form repeater?

     

    Best Wishes,

    Nigel.

    Sean
    Sean
    Keymaster

    Posts: 4056
    Support Staff Reply #13123

    Hi @nigelbogle,

    Unfortunately we don’t have this snippet. I hope @h85jbknqployviy will read your message and reply you.

    Thanks.

You must be logged in to reply to this topic.