This file contains 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
import {PDPFieldReader} from 'PDPFieldReader' | |
export class PDPFieldWriter { | |
static set_FormFieldValue = (fieldName: string, value: string) => { | |
var inputField = $('Input[Title="' + fieldName + '"]'); | |
if (inputField.length == 0) { | |
console.warn("Couldn't find form field " + fieldName); | |
return ""; |
This file contains 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
var script = document.createElement('script');script.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js";document.getElementsByTagName('head')[0].appendChild(script); | |
function retrieveData(url) { | |
var dfd = jQuery.Deferred(); | |
console.log('Data url is + ' + url) | |
jQuery.ajax({url:url, | |
type: "GET", | |
dataType: "json", | |
headers: {Accept: "application/json;odata=verbose" } |
This file contains 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
export class PDPFieldReader { | |
static get_FormFieldValue_Number = (fieldName: string, editMode: boolean): number => { | |
return Number(PDPFieldReader.get_FormFieldValue_Text(fieldName,editMode).replace(/[^0-9\.]+/g, "")); | |
} | |
static get_FormFieldValue_Date = (fieldName: string, editMode: boolean): Date => { | |
var textValue = PDPFieldReader.get_FormFieldValue_Text(fieldName, editMode); | |
// parsing for UK dd/mm/yyyy |
This file contains 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
window.console = window.console || (function(){ | |
var c = {}; c.log = c.warn = c.debug = c.info = c.error = c.time = c.dir = c.profile = c.clear = c.exception = c.trace = c.assert = function(){}; | |
return c; | |
})(); |
This file contains 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
_spBodyOnLoadFunctionNames.push("myScriptStartup"); | |
function myScriptStartup () { | |
var editMode = EditState.Editing; | |
if (editMode) { | |
// PDP is in edit mode | |
// Do things differently here | |
console.log('PDP is in edit mode. so our input fields will be editable'); | |
} | |
else { |
This file contains 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
_spBodyOnLoadFunctionNames.push("myScriptStartup"); | |
function myScriptStartup () { | |
var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value; | |
if (inDesignMode == "1") { | |
// page is in edit mode | |
// Do things differently here | |
console.log('Page is in edit mode. so we will not execute the custom script'); | |
} | |
else { |