php - Symfony 3 undisabled select not submitting -


i have read select defined formbuilder:

    ->add('sampledby', entitytype::class, array(         'class' => 'appbundle:fosuser',         'query_builder' => function (entityrepository $er) {             return $er->createquerybuilder('u')                 ->orderby('u.cn', 'asc');         },         'choice_label' => 'cn',         'disabled' => true     )) 

which use jquery update field in form. following this answer, i've set select can't changed user:

*set disabled on create.

*before submit set disabled = false:

 $(form).on('submit', function() {      $("select[id$='sampledby']").prop('disabled', false);  }); 

now, on submit see select field change disabled = false (the colour changes white , it's clickable while form submits. however, data isn't saved.

has seen similar behavior? jquery appears work correctly, i'm wondering if it's symfony specific issue.

the state not changed in browser if html said so.

to pass this, changed field readonly through javascript , changed css make it's disabled.

->add('sampledby', entitytype::class, array(         'class' => 'appbundle:fosuser',         'query_builder' => function (entityrepository $er) {             return $er->createquerybuilder('u')                 ->orderby('u.cn', 'asc');         },         'choice_label' => 'cn',         'disabled' => false     )) 

in css

.readonly{ background-color: transparent !important;   border : 0px !important;     box-shadow: none; } .disabled{ background-color: transparent !important;   border : 0px !important;     box-shadow: none; } 

Comments