Creating Form Field HTML

If the view you're customizing includes a form, you don't have to hand-code the fields into your new layout.

The portal.getFields() method will return an array of field data for the form. Pass in the view ID as an argument.

For example, this would store an array of field data for the sign-in page to the fields variable:
// Get the field data for this view
var fields = portal.getFields('signin');

The portal.getPartial('createField', field, view) method provides a way to automatically generate markup for each of the fields.

To create the field markup, you can loop through the array of fields and pass each on into the method. Replace view with the actual view ID.

Here are examples using the JavaScript Array.map() method to create an array of field markup, and Array.join() to combine them into a single string:
// Get the field data for this view
var fields = portal.getFields('signin');
// Create the field markup
var fieldsHTML = fields.map(function (field) {
    return portal.getPartial('createField', field, 'signin');
}).join('');