In a SharePoint edit form, I know that you can show/hide fields based on a drop down field value (SPUtility Show Hide Field Based on Value from another field Custom Form) but I wanted to show/hide based on whether a datepicker has a value.
I have the following fields "Work Start Date" and "Work End Date". I want to hide Work End Date if Work Start Date is empty/null
I tried using == null and == "" and even > "1/1/1900" but the jquery does not seem to recognize the value in the Work Start Date field. I also tried an alert just to see if it was reading the value and the alert didn't generate.
Here is my code (using Jqyuery 3.1.1 and sputility):
//Does not show work end date when work start date is not null
$(document).ready(function()
{if ($("select[title='Work Start Date']").val() == null)
{
$('nobr:contains("Work End Date")').closest('tr').hide();
}
else
{
$('nobr:contains("Work End Date")').closest('tr').show();
}
});
Alternately, I tried using a calculated field called "Status" with a value of "Not Started" to hide the Work End Date field. This also did not work. I can get the fields to hide or show but not to conditionally show/hide. Any Advise you can provide would be very helpful. My company does not allow InfoPath or SharePoint Designer.