I have a custom page layout that is used to display pages in an enterprise wiki (each page has the context of a list item / publishing page).
I am trying to use a hidden field on the page to communicate some information to my javascript.
if I add this to my page layout in SP Designer:
<input type="hidden" id='hidden_UIVersionId' value='<SharePoint:FormField id="fieldUIVersion" runat="server" ControlMode="Display" FieldName="_UIVersion" />' />
then it works at first, but if I reload the page in SP Designer then the content gets mangled, and if I re-save that document then it fails the next time I try to load a wiki page:
<input id='hidden_UIVersionId' value='<SharePoint:FieldValue id="fieldUIVersion" runat="server" FieldName="_UIVersion" __designer:Preview="27,137" __designer:Values="<P N='FieldName' T='_UIVersion' /><P N='ItemFieldValue' Serial='AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAFqAAAL' /><P N='ListItemFieldValue' Serial='AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAFqAAAL' /><P N='Visible' T='True' /><P N='ControlMode' E='1' /><P N='InDesign' T='False' /><P N='ID' ID='1' T='fieldUIVersion' /><P N='Page' ID='2' /><P N='TemplateControl' R='2' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />"/>' />
How do I output a field value as a hidden input control on a layout page?