powermail icon indicating copy to clipboard operation
powermail copied to clipboard

[FEATURE] parsley step by step validation.

Open Megafry opened this issue 5 years ago • 0 comments

One of my customer needed a step by step validation: based on the official parsley-doc i came up with this solution: can this be added as a feature?

$('.powermail_form fieldset').each(function(index, section) {
  $(this).attr('data-parsley-group-index',index)
  $(this).find(':input').attr('data-parsley-group', 'block-' + (index + 1));
});
function curIndex() {
  return $('.powermail_form fieldset:visible').attr('data-parsley-group-index');
}
$('body').on('click','.powermail_tab_navigation a',function(e) {
  e.preventDefault();
console.log(['->',curIndex()])
  $('.powermail_form').parsley().whenValidate({
    group: 'block-' + curIndex()
  }).done(function() {
    //return 1
  });
});

Megafry

Megafry avatar Nov 25 '20 12:11 Megafry