Simple Form Portlet Script

This sample creates a portlet that includes a simple form with a text field and a submit button.

           /**
 * @NApiVersion 2.1
 * @NScriptType Portlet
 */

define([], function() {
        function render(params) {
            var portlet = params.portlet;
            portlet.title = 'Simple Form Portlet';

            var fld = portlet.addField({
                id: 'text',
                type: 'text',
                label: 'Text'
            });

            fld.updateLayoutType({
                layoutType: 'normal'
            });

            fld.updateBreakType({
                breakType: 'startcol'
            });

            portlet.setSubmitButton({
                url: 'http://httpbin.org/post',
                label: 'Submit',
                target: '_top'
            });
        }

        return {
            render: render
        };
}); 

        

General Notices