When configuring a custom search in the WebLink designer using a date range the date range calendar only goes from 1964 to 2064. You can manually type in a date before 1964 or after 2064 with no issue. Has anyone found a way to modify this the dropdown to show older dates or change the range to say 1925-2025?
Question
Question
Answer
Open up the "calendar8.aspx" file and after the </html> tag add the following code:
<script language="vbscript" runat="server"> Private Sub Page_PreRenderComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.PreRenderComplete, Me.PreRenderComplete If Not Page.IsPostBack Then Dim year_min As Integer = DateTime.Now.AddYears(-180).Year Dim year_max As Integer = DateTime.Now.AddYears(50).Year Dim y As Integer = 0 dropDownYear.Items.Clear() For y = year_min To year_max dropDownYear.Items.Add(New ListItem((y).ToString(), y)) dropDownYear.SelectedValue = myCalendar.SelectedDate.ToString("yyyy") dropDownMonth.SelectedIndex = Integer.Parse(myCalendar.SelectedDate.ToString("MM")) - 1 Next End If End Sub </script>
You will need to change the variables year_min and year_max to suite your needs.
You are very welcome and glad it worked well for you Drew!
HI Wes,
I was trying to apply the same fix in our environment but it did not work. Am I missing anything? I even restarted the server, but no change happened at all. Any help would be appreciated it. Thanks.
Wissam
Wisam,
The entire code base for Weblink has changed since this solution was written so it's a bit different with Weblink 10.x.
In order to change the date range for a custom search date picker in Weblink 10.x you will need to open up the jquery-ui.min.js file located in the resources folder in the Laserfiche Weblink installation directory (example: Program Files\Laserfiche\Weblink\Web Files\javascript\resources\ ).
Once you have that file open in a text editor you want to find the following line in the code (line 69 if you are using an IDE)
yearRange: "c-10:c+10",
The first value c-10 indicates how far back you wish to go. The second value c+10 indicates how far in the future you wish to go. So for example if you wish to go back 150 years and only 9 years in the future it would look like this:
yearRange: "c-150:c+9",
Once you have made your changes, save the file and then refresh your browser. Please note that any future upgrades to Weblink will overwrite your changes.