custom validation inside an enterprise wiki page layout

%3CP%3Eand%20here%20is%20the%20Date%20field%20rendered%20inside%20the%20Page%20Layout%3A-%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20226px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117691i013264CBE6546B21%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22expiredate.png%22%20title%3D%22expiredate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ENow%20i%20want%20to%20add%20a%20validation%2C%20that%20the%20expiry%20date%20must%20be%20%26gt%3B%3D%20Today%3C%2FSTRONG%3E.%20so%20i%20read%20this%20article%20about%20how%20i%20can%20add%20custom%20validation%20to%20our%20page-layout%20using%20javascript%20%3CA%20href%3D%22http%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%3C%2FA%3E%2C%20but%20the%20author%20of%20the%20article%20did%20not%20show%20where%20we%20need%20to%20add%20the%20code.%3C%2FP%3E%3CP%3Eso%20in%20my%20case%20i%20open%20the%20Enterprisewiki.aspx%20page%20layout%20using%20SP%20designer%2C%20and%20i%20added%20this%20test%20script%20before%20closing%20the%20%20tab%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22tag%22%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3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bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%2F%2F%20should%20prevent%20the%20page%20from%20been%20saved..%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22tag%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3Bbut%20when%20i%20add%20or%20edit%20a%20wiki%20pages%20and%20i%20click%20on%20save%20the%20alert%20will%20not%20be%20shown%20%2B%20the%20submission%20will%20complete.%20so%20can%20anyone%20advice%20on%20how%20i%20can%20add%20custom%20validation%20to%20a%20Date%20field%20inside%20our%20Enterprisewiki.aspx%20page%20layout%3F%20Thanks%20in%20advance%20for%20any%20help.%3C%2FP%3E%3CP%3Eand%20here%20is%20the%20Date%20field%20rendered%20inside%20the%20Page%20Layout%3A-%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20226px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117691i013264CBE6546B21%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22expiredate.png%22%20title%3D%22expiredate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ENow%20i%20want%20to%20add%20a%20validation%2C%20that%20the%20expiry%20date%20must%20be%20%26gt%3B%3D%20Today%3C%2FSTRONG%3E.%20so%20i%20read%20this%20article%20about%20how%20i%20can%20add%20custom%20validation%20to%20our%20page-layout%20using%20javascript%20%3CA%20href%3D%22http%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%3C%2FA%3E%2C%20but%20the%20author%20of%20the%20article%20did%20not%20show%20where%20we%20need%20to%20add%20the%20code.%3C%2FP%3E%3CP%3Eso%20in%20my%20case%20i%20opened%20the%20Enterprisewiki.aspx%20page%20layout%20using%20SP%20designer%2C%20and%20i%20added%20this%20test%20script%20before%20closing%20the%20%20tab%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22tag%22%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3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%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22str%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%22should%20show%20just%20before%20submitting%20the%20page%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B)%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%20%20%20%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3Breturn%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3Bfalse%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3B%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22com%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%2F%2F%20should%20prevent%20the%20page%20from%20been%20saved..%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22tag%22%26amp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3Ebut%20when%20i%20add%20or%20edit%20a%20wiki%20page%20and%20i%20click%20on%20save%20the%20alert%20will%20%3CSTRONG%3Enot%3C%2FSTRONG%3E%20be%20shown%20%2B%20the%20submission%20will%20complete.%20so%20can%20anyone%20advice%20on%20how%20i%20can%20add%20custom%20validation%20to%20a%20Date%20field%20inside%20our%20Enterprisewiki.aspx%20page%20layout%3F%20Thanks%20in%20advance%20for%20any%20help.%3C%2FP%3E%3CLINGO-SUB%20id%3D%22lingo-sub-681977%22%20slang%3D%22en-US%22%3Ecustom%20validation%20inside%20an%20enterprise%20wiki%20page%20layout%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-681977%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20working%20on%20an%20enterprise%20wiki%20site%20collection%20inside%20sharepoint%20farm%202013.%20I%20have%20a%20Date%20field%20named%20%22ExpireDate%22%20and%20i%20added%20it%20inside%20the%20EnterpriseWiki.aspx%20page%20layout.%20Here%20is%20the%20markup%20for%20the%20Date%20field%20inside%20the%20Page%20Layout%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22tag%22%3E%3CDATETIMEFIELD%3E%3C%2FDATETIMEFIELD%3E%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3EFieldName%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%225597d368-6f9d-4983-84e5-fa48f40a7a3f%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22atn%22%3Erunat%3C%2FSPAN%3E%3CSPAN%20class%3D%22pun%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22atv%22%3E%22server%22%3C%2FSPAN%3E%3CSPAN%20class%3D%22tag%22%3E%26gt%3B%3C%2FSPAN%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CP%3Eand%20here%20is%20the%20Date%20field%20rendered%20inside%20the%20Page%20Layout%3A-%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20226px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117691i013264CBE6546B21%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22expiredate.png%22%20title%3D%22expiredate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3ENow%20i%20want%20to%20add%20a%20validation%2C%20that%20the%20expiry%20date%20must%20be%20%26gt%3B%3D%20Today%3C%2FSTRONG%3E.%20so%20i%20read%20this%20article%20about%20how%20i%20can%20add%20custom%20validation%20to%20our%20page-layout%20using%20javascript%20%3CA%20href%3D%22http%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Ffrontendfreaks.com%2Fcustom-validation-in-sharepoint-2013-page-layouts%2F%3C%2FA%3E%2C%20but%20the%20author%20of%20the%20article%20did%20not%20show%20where%20we%20need%20to%20add%20the%20code.%3C%2FP%3E%3CP%3Eso%20in%20my%20case%20i%20opened%20the%20Enterprisewiki.aspx%20page%20layout%20using%20SP%20designer%2C%20and%20i%20added%20this%20test%20script%20before%20closing%20the%20%20tab%3A-%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%20class%3D%22tag%22%3E%3CSCRIPT%3E%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22atn%22%26amp%3Bamp%3Bamp%3Bgt%3Btype%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B%3D%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22atv%22%26amp%3Bamp%3Bamp%3Bgt%3B%22text%2Fjavascript%22%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22tag%22%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22typ%22%26amp%3Bamp%3Bamp%3Bgt%3BPage%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B.%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22typ%22%26amp%3Bamp%3Bamp%3Bgt%3BClientScript%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B.%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22typ%22%26amp%3Bamp%3Bamp%3Bgt%3BRegisterOnSubmitStatement%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B(%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bgt%3Bthis%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B.%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22typ%22%26amp%3Bamp%3Bamp%3Bgt%3BGetType%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B()%2C%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22str%22%26amp%3Bamp%3Bamp%3Bgt%3B%22validate_page%22%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B%2C%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22str%22%26amp%3Bamp%3Bamp%3Bgt%3B%22%20if%20(!validate())%20%7B%20return%20false%3B%20%7D%3B%20%22%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B)%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%0A%0A%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bgt%3Bfunction%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pln%22%26amp%3Bamp%3Bamp%3Bgt%3B%20validate_page%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B()%7B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pln%22%26amp%3Bamp%3Bamp%3Bgt%3B%20%0A%20%20%20%20alert%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B(%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22str%22%26amp%3Bamp%3Bamp%3Bgt%3B%22should%20show%20just%20before%20submitting%20the%20page%22%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B)%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%0A%20%20%20%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bgt%3Breturn%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22kwd%22%26amp%3Bamp%3Bamp%3Bgt%3Bfalse%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%20%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22com%22%26amp%3Bamp%3Bamp%3Bgt%3B%2F%2F%20should%20prevent%20the%20page%20from%20been%20saved..%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22pun%22%26amp%3Bamp%3Bamp%3Bgt%3B%7D%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%0A%26amp%3Bamp%3Bamp%3Blt%3BSPAN%20class%3D%22tag%22%26amp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22tag%22%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3Ebut%20when%20i%20add%20or%20edit%20a%20wiki%20page%20and%20i%20click%20on%20save%20the%20alert%20will%20%3CSTRONG%3Enot%3C%2FSTRONG%3E%20be%20shown%20%2B%20the%20submission%20will%20complete.%20so%20can%20anyone%20advice%20on%20how%20i%20can%20add%20custom%20validation%20to%20a%20Date%20field%20inside%20our%20Enterprisewiki.aspx%20page%20layout%3F%20Thanks%20in%20advance%20for%20any%20help.%3C%2FP%3E%3CLINGO-LABS%20id%3D%22lingo-labs-681977%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3E2013%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Super Contributor

I am working on an enterprise wiki site collection inside sharepoint farm 2013. I have a Date field named "ExpireDate" and i added it inside the EnterpriseWiki.aspx page layout. Here is the markup for the Date field inside the Page Layout:-

 

<SharePoint:DateTimeField FieldName="5597d368-6f9d-4983-84e5-fa48f40a7a3f" runat="server"></SharePoint:DateTimeField>

and here is the Date field rendered inside the Page Layout:-

expiredate.png

Now i want to add a validation, that the expiry date must be >= Today. so i read this article about how i can add custom validation to our page-layout using javascript http://frontendfreaks.com/custom-validation-in-sharepoint-2013-page-layouts/, but the author of the article did not show where we need to add the code.

so in my case i opened the Enterprisewiki.aspx page layout using SP designer, and i added this test script before closing the </asp:Content> tab:-

 

<script type="text/javascript">
Page.ClientScript.RegisterOnSubmitStatement(this.GetType(), "validate_page", " if (!validate()) { return false; }; ");

function validate_page(){ 
    alert("should show just before submitting the page");
    return false; // should prevent the page from been saved..
}
</script>
</asp:Content>

but when i add or edit a wiki page and i click on save the alert will not be shown + the submission will complete. so can anyone advice on how i can add custom validation to a Date field inside our Enterprisewiki.aspx page layout? Thanks in advance for any help.

0 Replies