Manager

fd

Forms designer manager global variable.

Manager

Forms designer manager class.

Methods:

field(internalName)Returns field by its internal name. Returns object of Field type.

Ex.:

fd.field('Title')
onsubmit(handler)Adds handler on save event.

Ex.:

fd.onsubmit(function(){
  return confirm('Are you sure you want to save changes?');
});
save()Returns save button jquery-object
cancel()Returns cancel button jquery-object
saveText(text)Gets or sets save button title.

Ex.:

fd.saveText('Save task');
cancelText(text)Gets or sets cancel button title.

Ex.:

fd.cancelText('Return');
openFormInDialog
(filename, queryParams, callback)
Opens specified form in a dialog.

filename
A name of the form-file that has to be opened in a dialog.
ex.:

'fd_Contact_Display.aspx'

queryParams
An object that contains additional parameters for query string. By default, the form is opened with the same query string as the current page is.
ex.:

{ID: 3, Source: '/'}

callback
A function that is called when a dialog is closed.
ex.:

function(){ alert('Dialog is closed.'); }

Ex.:

fd.openFormInDialog('fd_Contact_Display.aspx');
openForm(filename, queryParams)Redirects to specified form.

filename
A name of the form-file that has to be opened in a dialog.
ex.: ‘fd_Contact_Display.aspx’

queryParams
An object that contains additional parameters for query string. By default, the form is opened with the same query string as the current page is.
ex.: {ID: 3, Source: ‘/’}

Ex.:

fd.openForm('fd_Contact_Display.aspx');
backToPrevForm()Redirects to the previously opened form.

Ex.:

fd.backToPrevForm();
getSourceID()Returns ID of the parent item if the current form is opened from the parent form and null otherwise.

Ex.:

fd.getSourceID();
setUrlParam(uri, key, value)Adds or updates query parameter in provided URL with a specified value and returns a new URL.

url
Source URL-string

key
Name of query string parameter

value
New value of query parameter

Ex.:

fd.setUrlParam(window.location.href, 'FDRedirectWithID', 'fd_Item_Edit.aspx?ID=');
getUrlParam(uri, key)Returns value of a specified query parameter from provided URL.

url
Source URL-string

key
Name of query string parameter

Ex.:

fd.getUrlParam(window.location.href, 'Source');
sourceFormParam
(value)
Gets or sets ‘Source’ query parameter of the URL which is contained in action attribute of the form. Source parameter contains URL of the page where users will be redirected after the submission of the form. If value is not specified the function returns the current value of ‘Source’ parameter.

Ex.:

fd.sourceFormParam(window.location.href);
updateDroppedDocuments
(container, fieldValues)
Defines default values for documents dropped onto the specified Related items control. Added in Forms Designer 2.8.8. Supported by SharePoint 2013/2016 and SharePoint Online only

container
A JQuery selector of Related items container which may contain one or more Related items controls.

fieldValues
An object containing default values of fields. Ex.:

{ 
  Lookup: GetUrlKeyValue('ID'), 
  Status: 'Closed' 
}

Note: field names of the object have to match internal names of the related library.

Ex.:

fd.updateDroppedDocuments($('.related-docs'), { 
  Event: GetUrlKeyValue('ID')
});
updateDroppedDocuments
(container, callback)
Alternatively, you can pass on a function, that takes the newly uploaded document as a parameter, instead of an object. This functionality is added in Forms Designer 3.1.4. Supported by SharePoint 2013/2016 and SharePoint Online only.

container
A JQuery selector of Related items container which may contain one or more Related items controls.

callback
Callback is a handler that is executed for each uploaded document. As an input parameter it accepts a list item related to an uploaded document. It can return jQuery-promise if contains asynchronous operations.

Ex.:

fd.updateDroppedDocuments($('.related-docs'), function(listItem) {
    var result = $.Deferred();
    return result; 
});

You can read more about it here

populateFieldsInGrid
(container, fieldValues)
Defines default values for items added into the specified Related items control in Quick Edit mode (Grid mode). Added in Forms Designer 3.0.4. Supported by SharePoint 2013/2016 and SharePoint Online only

container
A JQuery selector of Related items container which may contain one or more Related items controls.

fieldValues
An object containing default values of fields. Ex.:

{
  Lookup: GetUrlKeyValue('ID'),
  Date: '9/15/2015'
}

Note: field names of the object have to match internal names of the related list.

fd.populateFieldsInGrid($('.related-items'), {
  Parent: '{CurrentItem}',
  User: _spPageContextInfo.userId,
  Text: 'Default Text',
  Date: '2/23/2017'
})
isMobileDevice()Returns a Boolean value representing if current user agent is a mobile device.

Ex.:

fd.isMobileDevice();
isTabletDevice()Returns a Boolean value representing if current user agent is a tablet device.
Ex.:

fd.isTabletDevice();
tabControl(index)Returns a JQuery object of the tab control specified by index.
Ex.:

fd.tabControl(4);
accordion(index)Returns a JQuery object of the accordion control specified by index.
Ex.:

fd.accordion(1)