There is any option Field for validation the column:-
<Validation Message="You must specify a value for
correct answer field.">
</Validation>
Below is the schema.xml file include custom validation in column
xml version="1.0"
encoding="utf-8"?>
<List xmlns:ows="Microsoft
SharePoint" Title="Question
List" FolderCreation="FALSE"
Direction="$Resources:Direction;" Url="Lists/QuestionList"
BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/">
<MetaData>
<ContentTypes>
</ContentTypes>
<Fields>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F5673F9}"
Name="Title"
DisplayName="Question"
Type="Text"
MaxLength="256"
Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F5773F9}"
Name="Answer1"
DisplayName="Answer 1"
Type="Text"
MaxLength="256"
Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F5873F9}"
Name="Answer2"
DisplayName="Answer 2"
Type="Text"
MaxLength="256"
Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F5973F9}"
Name="Answer3"
DisplayName="Answer 3"
Type="Text"
MaxLength="256"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6073F9}"
Name="Answer4"
DisplayName="Answer 4"
Type="Text"
MaxLength="256"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6173F9}"
Name="Answer5"
DisplayName="Answer 5"
Type="Text"
MaxLength="256"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6273F9}"
Name="Answer6"
DisplayName="Answer 6"
Type="Text"
MaxLength="256"></Field>
<Field Type="Choice" DisplayName="Correct
Answer" Required="TRUE" EnforceUniqueValues="FALSE"
Indexed="FALSE"
Format="Dropdown"
FillInChoice="FALSE"
ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6373F9}"
Name="Correct
Answer" Version="1">
<CHOICES>
<CHOICE>1</CHOICE>
<CHOICE>2</CHOICE>
<CHOICE>3</CHOICE>
<CHOICE>4</CHOICE>
<CHOICE>5</CHOICE>
<CHOICE>6</CHOICE>
</CHOICES>
<Validation Message="You must specify a value for
correct answer field.">
=IF([Correct
Answer]="3",IF(ISBLANK([Answer3]),False,True),IF([Correct
Answer]="4",IF(ISBLANK([Answer4]),False,True),IF([Correct
Answer]="5",IF(ISBLANK([Answer5]),False,True),IF([Correct
Answer]="6",IF(ISBLANK([Answer6]),False,True),True)))
</Validation>
</Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6473F9}"
Name="CorrectAnswer" DisplayName="Correct
Answer" ShowInDisplayForm="FALSE"
ShowInEditForm="FALSE"
ShowInNewForm="FALSE"
Type="Text"
MaxLength="256"
Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E9169F6573F9}"
Name="DisplayOrder" DisplayName="DisplayOrder" Type="Number"
Decimals="0" Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6673F9}"
Name="Active"
DisplayName="Active"
Type="Boolean"
Required="TRUE"></Field>
<Field ID="{8BD30E52-9D36-4CDC-BEBB-E8169F6773F9}"
Name="AnswerDescription" DisplayName="Answer
Description" Type="Note"></Field>
</Fields>
<Views>
<View BaseViewID="0" Type="HTML"
MobileView="TRUE"
TabularView="FALSE">
<Toolbar Type="Standard"
/>
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitleNoMenu"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)"
/>
<ParameterBinding Name="NoAnnouncements"
Location="Resource(wss,noXinviewofY_LIST)"
/>
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)"
/>
</ParameterBindings>
</View>
<View BaseViewID="1" Type="HTML"
WebPartZoneID="Main"
DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE"
MobileView="TRUE"
MobileDefaultView="TRUE"
SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
<Toolbar Type="Standard"
/>
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">30</RowLimit>
<ViewFields>
<FieldRef Name="ID"></FieldRef>
<FieldRef Name="Title"></FieldRef>
<FieldRef Name="Answer1"></FieldRef>
<FieldRef Name="Answer2"></FieldRef>
<FieldRef Name="Answer3"></FieldRef>
<FieldRef Name="Answer4"></FieldRef>
<FieldRef Name="Answer5"></FieldRef>
<FieldRef Name="Answer6"></FieldRef>
<FieldRef Name="CorrectAnswer"></FieldRef>
<FieldRef Name="Active"></FieldRef>
<FieldRef Name="AnswerDescription"></FieldRef>
<FieldRef Name="DisplayOrder"></FieldRef>
<FieldRef Name="Author"></FieldRef>
<FieldRef Name="Editor"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="ID"></FieldRef>
</OrderBy>
</Query>
<ParameterBindings>
<ParameterBinding Name="NoAnnouncements"
Location="Resource(wss,noXinviewofY_LIST)"
/>
<ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)"
/>
</ParameterBindings>
</View>
</Views>
<Forms>
<Form Type="DisplayForm"
Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"
/>
<Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"
/>
<Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main"
/>
</Forms>
</MetaData>
</List>
No comments:
Post a Comment