Step 1: Creating your clientlibs folder with the following properties:
<?xml version=”1.0″ encoding=”UTF-8″?>
<jcr:root xmlns:cq=”http://www.day.com/jcr/cq/1.0″ xmlns:jcr=”http://www.jcp.org/jcr/1.0″
jcr:primaryType=”cq:ClientLibraryFolder”
categories=”[cq.authoring.dialog,abc.components.banner]”
dependencies=”[granite.jquery]”/>
Step 2: I am creating a event listener in my case and in that I will be getting the values of multifield.
(function(document, $, ns) {
“use strict”;
$(document).on(“click”, “.cq-dialog-submit”, function(e) {
var $formminmax = $(this).closest(“form.foundation-form”);
var text= $formminmax.find(“[name=’./text’]”).val(); // This will contain the textfield data having name property as idSelector.
var field = $formminmax.find(“[data-granite-coral-multifield-name=’./multi’]”);
var totalLinkCount = field.children(‘coral-multifield-item’).length;
var prodData = []; //This will store the multifield data from the dialog.
for (var i = 0; i < totalLinkCount; i++) {
prodData.push(field.find($(“[name=’./data’]”)[i]).val());
}
});
})(document, Granite.$, Granite.author);
No comments:
Post a Comment
If you have any doubts or questions, please let us know.