Client Side Rendering: Grabbing all fields on using OnPostRender

Here is a Visual Studio Project that has demos of various ways of using client side rendering including this one:

VSO Project

In this example I modified the schema.xml file to and created a CustomNewForm.aspx. Remember to set Deployment Type to ElementFile. The code in CSRExample1.js is meant to grab all the field on after the CustomNewForm.aspx has rendered.

CustomNewForm.aspx

schema.xml

How do I: Populate a drop-down

The schema.xml will look like:

 <Field Name=”NomStatus” ID=”{6f37ad73-3881-4411-bb98-b2f4dd0273b0}” DisplayName=”Status” Format=”Dropdown” Type=”Choice”>
        <CHOICES>
          <CHOICE>Pending Approval</CHOICE>
          <CHOICE>Approved</CHOICE>
          <CHOICE>Rejected</CHOICE>
        </CHOICES>
      </Field>

The elements.xml will look like:

<Field Name=”NomStatus”>Approved</Field>

Adding Date to element.xml

elements.xml

    <Data>
      <Rows>
        <Row>
          <Field Name=”DOB”>2015-12-01</Field>        
        </Row>
      </Rows>
    </Data>

schema.xml

<Field Name=”DOB” ID=”{3441d411-3bcf-4587-af39-2ae2f6414223}” DisplayName=”DOB” Type=”DateTime” Format=”DateOnly” />

How do I populate a “Lookup” field via Elements.xml?

The schema.xml will look like:

  <Field Name=”Achievements” ID=”{3e69c1-b538-497b-a7f6-8b4388b8e}” DisplayName=”Achievements” Type=”Lookup” Format=”Dropdown” List=”Lists/Achieve_List” ShowField=”Achieve” >

The elements.xml will look like:

<Field Name=”Achievements”>1</Field>

OR (or if it’s a multiple value lookup field it will look like)

<Field Name=”Achievements”>1;#;#2;#;#3</Field>