Skip to main content
deleted 12 characters in body
Source Link
Hudri
  • 5.2k
  • 3
  • 20
  • 56

i was able to get the value of surname from the Formstate, the form state had surname in surname field itself. public static function validate(array &$element, FormStateInterface $formState, array &$form) {

public static function validate(array &$element, FormStateInterface $formState, array &$form) {      
    $webformKey = $element['#webform_key'];       
    $value = $formState->getValue($webformKey);
    $surname= $formState->getValue('surname');
    }

this did the trick.

i was able to get the value of surname from the Formstate, the form state had surname in surname field itself. public static function validate(array &$element, FormStateInterface $formState, array &$form) {

    $webformKey = $element['#webform_key'];       
    $value = $formState->getValue($webformKey);
    $surname= $formState->getValue('surname');
    }

this did the trick.

i was able to get the value of surname from the Formstate, the form state had surname in surname field itself.

public static function validate(array &$element, FormStateInterface $formState, array &$form) {      
    $webformKey = $element['#webform_key'];       
    $value = $formState->getValue($webformKey);
    $surname= $formState->getValue('surname');
}

this did the trick.

Source Link

i was able to get the value of surname from the Formstate, the form state had surname in surname field itself. public static function validate(array &$element, FormStateInterface $formState, array &$form) {

    $webformKey = $element['#webform_key'];       
    $value = $formState->getValue($webformKey);
    $surname= $formState->getValue('surname');
    }

this did the trick.