1

I have two fields; one is normal text box used to generate system current date and the another field is <sharepoint :datetime control >

I need to validate this two: the date selected in SharePoint datetime control is not less than the date generated in text box.

Can anyone help me out?

Mohit Sikhwal
  • 418
  • 6
  • 17

2 Answers2

2

You can go to

List Settings -> Validation Settings

Mention there the validation you want, something like

[X_Date] > [Created]
Amit
  • 1,028
  • 7
  • 22
0

You can also use Asp:CompareValidator object instead of javascript. See sample code below

<SharePoint:DateTimeControl runat="server" ID="txtFrom" DateOnly="false" />
<SharePoint:DateTimeControl runat="server" ID="txtEnd" DateOnly="false" />
<asp:CompareValidator ID="cv" runat="server" Display="Dynamic" ForeColor="red" Type="Date" Operator="GreaterThanEqual" ControlToCompare="txtFrom$txtFromDate" ControlToValidate="txtEnd$txtEndDate"><img src="/_layouts/images/info16by16.gif"/> End Date should be more than Start Date</asp:CompareValidator>

Hope this helps you.

Anuja
  • 3,103
  • 4
  • 23
  • 27