0
votes

Im using 'client_side_validations' gem to validate my form. However it has display: none attribute at the beginning and I change it to display: block after jquery click action.

$(document).ready(function () {
  $('#thumb_up').on('click', function () {
    $('.vote_form').css('display', 'block');
  });
});

Unfortuantely then it does not work. When I use visibility instead it works. How to run it using display: none attr?

1
try using $('.vote_form').show() - Amit Patel
unfortunatelly the same effect - mike927

1 Answers

0
votes

The gem (see the source code) only initializes client side validation for visible inputs, i.e. elements that takes up space on the page.

After showing your form, you must enable client side validations:

$('.vote_form').enableClientSideValidations();

https://github.com/DavyJonesLocker/client_side_validations#enabling