1

Hello fellow Drupal users, I have created an advanced HTML element in my webform. When the form is submitted the advanced html element reverts back to the default setting, which in this case is option A1. The users selection and data for this element is not in the submission.

This is the YAML an example form:

processed_text:
  '#type': processed_text
  '#display_on': both
  '#text': |
    <select  name="processed_textone" id="processed_textone" style="width: 570px;"> 
    <optgroup label="A">    
        <option value="A1">A1</option>
        <option value="A2"> A2</option>
        <option value="A3"> A3</option>
    </optgroup>

    <optgroup label="B">    
        <option value="B1">B1</option>
    </optgroup>

    <optgroup label="C">    
        <option value="C1">C1</option>
        <option value="C2">C2</option>
    </optgroup>

  '#format': full_html

I would like to get the data of the selection upon submission. I tried using a computed twig and Ajax, but that doesn't seem to work either. I think I might be able to add a javascript file to get this data into the submission, but I'm not sure. I'm pretty new at subtheming and js in general.

3
  • 1
    Can't you just add a list(text) field to the webform via the UI?
    – user72672
    Commented Aug 28, 2019 at 16:52
  • 2
    What are you trying to do? Create a select menu with optgroups? Maybe see: drupal.org/project/webform/issues/2783937
    – jrockowitz
    Commented Aug 28, 2019 at 19:58
  • @jrockowitz that is exactly what I am trying to do. Thank you very, very much. Commented Aug 28, 2019 at 21:04

1 Answer 1

0

@jrockowitz suggested I look here; drupal.org/project/webform/issues/2783937

This solved my question. Thank you jrockowitz.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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