How do I find the default value or change state of a form element? I'm putting together a fairly complex form with Drupal 8 (currently building on beta 7). In my validation function, I need to be able to detect whether a field, which was populated with default values, has changed.

In Drupal 7, this would have been pretty straightforward. I could dig into the form_state array and find the appropriate default_value entry and compare it to the submitted value.

But now that form_state is an encapsulated object, I don't see an obvious way to get the default value.

I know I can kluge this if I need to, by including hidden fields in the form itself with the default values. But I know that the information is in the form_state object: if I print_r form_state I can see both the old and new values--but not in any way I can figure out how to access using the methods listed in FormStateInterface.

Bottom line: in Drupal 8, how do I test whether the submitted value of a form element is the same as its default value?
public function validateForm(array $form, FormSateInterface $form_state) {
  $element = $form['elementname'];
  $default_value = isset($element['#default_value']) ? $element['#default_value'] : NULL;
  $value = $form_state-&gt;getValue($element['#parents']);
  $changed = $default_value == $value;
    if ($changed) {
    // This is stupid, it's just an example.
    $form_state-&gt;setError($element, $this-&gt;t("The value has changed."));
    }
}