input validation inside page layout
-
08-12-2019 - |
문제
I have field called "program email" and this field is an email and part of page layout. what is the recommended way to validate that field to make sure that it is a valid email format and disable saving the page when the user enter invalid email format
해결책
You can use column validation on the site column associated with the page layout. You can edit the site column to add column valiation. Below shows example formula to check text field with @ and .com at the end.
=AND(ISNUMBER(FIND("@",[Email Address])),LOWER(RIGHT([Email Address],4)=".com"))
If you are using visual studio to deploy the field used in the content type of your page layout, try below
<Field
ID="{GUID}"
Overwrite="TRUE"
OverwriteInChildScopes="TRUE"
Name="EmailAddress"
DisplayName="Email Address"
Required="FALSE"
Type="Text"
Group="MyColumns">
<Validation Message="Enter email like someone@example.com">=AND(ISNUMBER(FIND("@",EmailAddress)),LOWER(RIGHT(EmailAddress,4)=".com"))</Validation>
</Field>
제휴하지 않습니다 sharepoint.stackexchange