Are masked inputs supported in custom composites?

I've tried the following and it doesn't break but it also doesn't mask.

$elements['job_details']['job_phone'] = [
  '#type' => 'textfield',
  '#input_mask' => '(999) 999-9999',
  '#title' => t('Company Phone Number')

If you want to get simple form elements to include webform element enhancements you have to 'initialize' the composite's sub-elements using \Drupal\webform\Element\WebformCompositeBase::initializeCompositeElements


If anyone else came here (like me) looking for a way to add an input mask to a custom composite created through the Webform Composite Tools UI, you just need to add a custom property to your (sub)element:

input_mask: '''alias'': ''currency'''

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.