Skip to main content

I want to ensure that the user does not select an end date before the start date.  In this scenario, both dates will already be populated (editing an existing row in a calendar pop-up).

I’m using the approach outlined here to use a custom field renderer to override a datepicker:
https://community.skuid.com/t/override-the-standard-date-picker?topic-reply-list%5Bsettings%5D%5Bfilter_by%5D=all

Specifically the minDate attribute as discussed here:https://community.skuid.com/t/how-to-disable-the-dates-in-datepicker

Here is the code for the custom field renderer:


var field = argumentsn0],&nbsp; &nbsp; sdate = argumentsn0].row.Start_Date__c; //datetime field<br>&nbsp; &nbsp; value = argumentsn1],<br>&nbsp; &nbsp; $ = skuid.$;<br>skuid.ui.fieldRenderersefield.metadata.displaytype]pfield.mode](field,value);<br>//convert to js date<br>var jsStartDate = skuid.time.parseSFDate(sdate);<br>console.log(jsStartDate);<br>if (field.mode==='edit'){<br>&nbsp; &nbsp;var dateInput = field.element.find('input.hasDatepicker');<br>&nbsp; &nbsp;dateInput.datepicker( "minDate", jsStartDate, true);<br>&nbsp; &nbsp;dateInput.datepicker("refresh");<br>}

The pop-up fails to display, and I get this error:Uncaught TypeError: Cannot read property ‘apply’ of undefined

I’ve searched this error, but cannot find anything applicable to this approach of modifying the datepicker.

Figured it out.  I had dropped one of the parameters.  minDate should be set like this:


...<br>dateInput.datepicker( "option", "minDate", jsStartDate);<br>...

Reply