Create Custom List Form For SharePoint List【2】

1.SPUtility.js

  Refer:https://sputility.codeplex.com/

2.Modify the method【getFieldParams】 for get field Display Name

  3.Supported Field Type for SPUtility.JS

  

Type SP Type Field Configuration Supported?
All Field Types Documentation      
Single line of text SPFieldText   Yes

Multiple lines of text

SPFieldNote

Plain text

Yes

Rich text (Bold, italics, text alignment)

Yes

Enhanced rich text (Rich text with pictures, tables, and hyperlinks)

Yes
Choice (menu to choose from) SPFieldChoice Drop-Down Menu Yes
Drop-Down Menu with fill in value Yes
Radio Buttons Yes
Radio Buttons with fill in value Yes
SPFieldMultiChoice Checkboxes (allow multiple selections) Yes
Checkboxes (allow multiple selections) with fill in value Yes
Number (1, 1.0, 100) SPFieldNumber   Yes
Content Type (as of v0.9.1) ContentTypeChoice    
Currency ($, ¥, €) SPFieldCurrency   Yes
Date and Time SPFieldDateTime Date Only Yes
Date & Time
Lookup (information already on this site) SPFieldLookup Allow multiple values = No Less than 20 values in the lookup list, displays as a dropdown using a SELECT. Yes
Allow multiple values = No If 20 or more values, displays as an autocomplete using a text INPUT. Yes
SPFieldLookupMulti Allow multiple values = Yes (displays as two list boxes) Yes
Yes/No (check box) SPFieldBoolean N/A Yes
Person or Group SPFieldUser Allow multiple selections: No Yes
SPFieldUserMulti Allow multiple selections: Yes Yes
Hyperlink or Picture SPFieldURL   Yes
Name column in a Document Library SPFieldFile   Yes
Rating Scale (a matrix of choices or a Likert scale) SPFieldGridChoice   No
All Day Event SPFieldAllDayEvent Calendar field. Checking the box causes a page postback and changes the Start and End Time fields to have a date portion only. No
Recurrence SPFieldRecurrence Calendar field. Checking the box causes a page postback in order to display controls to setup Daily/Weekly/Monthly/Yearly recurrence. No
Workspace SPFieldCrossProjectLink Similar to a yes/no field. Checking yes and then clicking Save will take you to a New Meeting Workspace page. No
Notice a field that isn't listed? Let me know!      

 

  4.Common used functions of SPUtility.js

  SPUtility.js core API

  • SPUtility.GetSPField(strFieldName) - Get a field on DispForm, EditForm, or NewForm by the field's display name. Returns an SPField object (see below).
  • SPUtility.GetSPFieldByInternalName(strFieldName) - Get a field by its internal column name. Returns an SPField object.
  • SPUtility.GetSPFields() - Get an object containing every field on the page. Field display name is the key and fieldParams is the value. May change in future versions.
  • SPUtility.GetSPFieldsInternal() - Get an object containing every field on the page. Field internal column name is the key and fieldParams in the value. (added in version 0.14.0)
  • SPUtility.HideSPField(strFieldName) - Shortcut for hiding a field by display name (faster than GetSPField if you need to hide a ton of fields at once).
  • SPUtility.ShowSPField(strFieldName) - Shortcut for showing a field by display name (faster than GetSPField if you need to show a ton of fields at once).
  • SPUtility.Setup(settings) - Configure how SPUtility works. Especially useful for different number formats and/or languages. See Setup below for more information. (added in version 0.14.0)

  SPFields

These objects are returned from a call to SPUtility.GetSPField. All fields support the following functions:

    • GetValue - Gets the fields value. *
    • SetValue - Sets the fields value. *
    • GetDescription - Get a field's description (added in version 0.11.0)
    • SetDescription - Set a field's description (added in version 0.11.0)
    • MakeReadOnly - Gets the value of the field and replaces any controls with a label preventing the user from editing the field
    • MakeEditable - The opposite of MakeReadOnly. Makes a field editable again. Does nothing if the field wasn't read only.
    • Hide - Hide's the entire field's row from view.
    • Show - Show's the field's row

5. Common SPField Properties 

For each field type, multiple properties are set. These make it easier to reference specific field elements. Every field has the following properties set:

    • Name - Display name of the field
    • InternalName - Internal column name
    • IsRequired - True if the field is required
    • Type - SharePoint field type
    • Controls - The element containing all the field's controls
    • ControlsRow - The parent table row containing the field's controls
    • Label - The element containing the column's name
    • LabelRow - The parent table row for the column's name
    • ReadOnlyLabel - Default is null, until MakeReadOnly is called, then it holds the reference to the read-only span element
posted @ 2017-09-11 10:05  【上海】Peter  阅读(370)  评论(0)    收藏  举报