Wednesday, 22 November 2017

Liferay autofields



Use the following code in your jsp page

<div id="link-fields">
                <div class="lfr-form-row lfr-form-row-inline">
                    <div class="row-fields">
                        <aui:input fieldParam='linkNumber0' id='linkNumber0' name="linkNumber0" label="Links" />
                    </div>
                </div>
            </div>
<aui:script use="liferay-auto-fields">
 new Liferay.AutoFields(
       {
           contentBox: '#link-fields',
           fieldIndexes: '<portlet:namespace />linksIndexes'
       }
   ).render();
</aui:script>



Use this in your action method

    String linksIndexesString = actionRequest.getParameter(
                "linksIndexes");
        System.out.println("=============linksIndexesString=="+linksIndexesString);
            int[] linksIndexes = StringUtil.split(linksIndexesString, 0);
            for (int linksIndex : linksIndexes) {
                String number = ParamUtil.getString(actionRequest, "linkNumber" + linksIndex);
                System.out.println("=============linkNumber=="+number);
                

            }

TEST

I am Java Developer. I have 6 year Experiance in this field and like to post in blogging. So keep sharing and like my post

0 comments:

Post a Comment

 

Copyright @ 2017 Liferay Article.