1

I have custom list in SharePoint 2013. That custom list made in element.xml and schema.xml. I am trying to put validation on list field using below method. For ex : https://docs.microsoft.com/en-us/sharepoint/dev/schema/validation-element-list But it doesn't reflect anything on SharePoint side.

Is anyone done this before? If yes then can you please suggest me the best way? And I am even not sure how to put that script in validation element.xml

Thanks, Heena.

0

Here is an example I tested with elements.xml.

The formula goes into the tag.

This is a validation rule that check if the field contains "http:// or "https://".

    <Field
        Type="Text"
        DisplayName="LocationUrl"
        Required="FALSE"
        EnforceUniqueValues="FALSE"
        Indexed="FALSE"
        MaxLength="255"
        ID="{5a6b348e-cc0d-4a50-9a7d-5a680c36e0b6}"
        SourceID="{c66bbf65-c9ff-40ee-9c0e-6895e5a72cfe}" StaticName="LocationUrl"
        Name="LocationUrl" ColName="nvarchar10" RowOrdinal="0"
        CustomFormatter="" Version="
        5">
    <Validation Message="Valid URL must include http:// or https:// or empty">=OR(ISNUMBER(FIND(&quot;http://&quot;,LocationUrl)),ISNUMBER(FIND(&quot;https://&quot;,LocationUrl)),LocationUrl=&quot;&quot;)</Validation>
    </Field>

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.