Closed varghesethomase closed 8 years ago
I don't understand. There's just no way Rails will change anything to the data-parsley-multiple
you are giving it. Did you check View Page Source
(Chrome) or equivalent?
What i have given in the second code snippet is the output what browser renders. And the first one is the raw slim file. 'data-parsley-multiple' => 'spbproof', in slim gets converted to data-parsley-multiple="merchant_requestkyc_shops_and_establishment_cert".
If you look at what the browser renders, there's a zillion things that might have changed the attribute. Your JS code, Parsley's, or something else.
I simply can't see how it could be possible that the slim source you provided would output the HTML you have.
What's the HTML source actually returned from the server?
Let me know if this is still an issue, and if so produce a CodePen with an example. Thanks.
@marcandre issue is still there. I think it's because you guys has some default value setter for checkbox and raido buttons,
if (name) {
$('input[name="' + name + '"]').each(function (i, input) {
var type = Utils.getType(input);
if (type === 'radio' || type === 'checkbox') input.setAttribute(_this.options.namespace + 'multiple', _this.options.multiple);
});
} // Check here if we don't already have a related multiple instance saved
I had to rewrite data_parsley_multiple when On load document. To make work validation that checks minimum check of check boxes.
I had a form, where i had given data-parsley-multiple attribute to a specific value. But rails automatically sets it to same that of the id attribute. And the real mess is that, it happens only to a specific portion of form and rest all sections with different data-parsley-multiple value works fine.
.form-group = f.check_box :kyc_shops_and_establishment_cert,'data-parsley-mincheck' => '1', 'data-parsley-multiple' => 'spbproof', 'data-parsley-group' => 'solepropbusinessproof', 'data-parsley-trigger' => 'click', class: 'kyc_checkbox' | = f.label :kyc_shops_and_establishment_cert, 'Shops and Establishment Certificate / Goumasta License (Preferred)'
compiles to<div class="form-group parsley-success"><input name="merchant_request[kyc_shops_and_establishment_cert]" value="0" type="hidden"><input data-parsley-id="9562" data-parsley-multiple="merchant_requestkyc_shops_and_establishment_cert" data-parsley-mincheck="1" data-parsley-group="solepropbusinessproof" data-parsley-trigger="click" class="kyc_checkbox" value="1" name="merchant_request[kyc_shops_and_establishment_cert]" id="merchant_request_kyc_shops_and_establishment_cert" type="checkbox"> <label for="merchant_request_kyc_shops_and_establishment_cert">Shops and Establishment Certificate / Goumasta License (Preferred)</label></div>