Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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="&lt;P N='FieldName' T='_UIVersion' /&gt;&lt;P N='ItemFieldValue' Serial='AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAFqAAAL' /&gt;&lt;P N='ListItemFieldValue' Serial='AAEAAAD/////AQAAAAAAAAAEAQAAAAxTeXN0ZW0uSW50MzIBAAAAB21fdmFsdWUACAFqAAAL' /&gt;&lt;P N='Visible' T='True' /&gt;&lt;P N='ControlMode' E='1' /&gt;&lt;P N='InDesign' T='False' /&gt;&lt;P N='ID' ID='1' T='fieldUIVersion' /&gt;&lt;P N='Page' ID='2' /&gt;&lt;P N='TemplateControl' R='2' /&gt;&lt;P N='AppRelativeTemplateSourceDirectory' R='-1' /&gt;"/>' />

How do I output a field value as a hidden input control on a layout page?

share|improve this question
I ended up using a div with display set to none. I'd love to know if there's a more elegant solution. – Chloraphil Feb 14 at 13:53

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.