Last active
June 11, 2018 20:39
-
-
Save vaderj/6e99b8cb3fccd5b8f554c013d8794e71 to your computer and use it in GitHub Desktop.
SharePoint new list item form - reading / hiding to fields with JavaScript / jQuery #Javascript #SharePoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Lookup Column: Allow multiple values | |
// jQuery Select: | |
jQuery("select[title='Vehicle']") ; | |
// read selected options | |
jQuery("select[title='Vehicle'] option:selected").text() ; | |
// Hide one of the OPTIONS in the drop down selector (addressed via value, NOT text): | |
jQuery("select[title='Vehicle'] option[value='2']").remove() | |
// Hide the field and its label from view | |
jQuery("select[title='Vehicle']").closest('tr').hide() | |
//Choice column - Drop-down menu / no Fill-in choices | |
// jQuery Select: | |
jQuery("select[title='Channel']") ; | |
//Multiple lines of text - Enhanced righ text - NO append | |
// jQuery Select: | |
jQuery(".ms-inputBox [id^='Vehicle_x0020__x002d__x0020_Note']") ; | |
//People and Group column - multiple selections, people only | |
// jQuery Select: | |
jQuery("input[title='From, Enter names or email addresses...']") ; | |
//Yes/No - Checkbox | |
// jQuery Select: | |
jQuery("input[title='HospComms?']") ; | |
// check to see if value == True | |
jQuery("input[title='HospComms?']").is(":checked") === true ; | |
// Hide the field and its label from view | |
jQuery("input[title='HospComms?']").closest("tr").hide(); | |
//Date/Time field | |
// jQuery Select: | |
jQuery("input[title='Publish time']") ; | |
// Hide the field and its label from view | |
jQuery("input[title='Publish time']").closest('.ms-formbody').closest('tr').hide() ; | |
// Hide the DESCRIPTION field of a URL column (column presents two input fields - URL and Description): | |
jQuery("input[title='Description']").siblings('.ms-formdescription').eq(1).hide() ; | |
jQuery("input[title='Description']").closest('tr').children('.ms-formbody').children('.ms-metadata').hide() ; | |
jQuery("input[title='Description']").hide() ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment