How to automatically change a Content type field value based on Date field? I'm using Drupal 7, I have a content type, where I have two fields for project allocation:


Status(Active/Inactive)
End Date 


If the "End date" is less than current date, then the "status field" should be Active(By Default, Status will be Active) and if it exceeds current date, then that particular "status field" value in Content type should automatically change to Inactive. 

Now, how can I automatically change the field value without any Button trigger?
I think you have to do this with some custom JS code.

You can do something like this:

$('.end-date-field').on('change', function () {
  var endDate = new Date($(this).val());
  if (endDate &lt; Date.now()) {
    $('.status-field').val('inactive');
  }
});


This code is not 100% correct, but it can help you to get an idea of what you have to do.