i am new to Drupal and i am building a form (Drupal 8)that needs to calculate an amount based on the input in two text fields. What i want to achieve is for the "calculate" button to be hidden until the two text fields have been filled but i'm not sure how to achieve this with behaviors. Code example:
$form['weight'] = array(
'#type' => 'number',
'#title' => t('Weight:'),
'#required' => TRUE,
'#attributes' => array(
'id' => 'weight',
),
);
$form['number'] = array(
'#type' => 'number',
'#title' => t('Number:'),
'#required' => TRUE,
'#attributes' => array(
'id' => 'number',
),
);
// Here if weight and number are not empty, show button
Thanks