New answers tagged

1

Is there any way to set this in a form_alter? Or should I just validate the checkbox state via JS? You could replace #required by setting a custom validation handler in the form alter hook, if you want to generate the error message server-side: $form_state->setErrorByName('field_tos_accept', $error_message); When I add '#required_error', this should - in ...


0

I solved this by attaching some javascript to my module... $form['#attached']['js'][] = array( 'data' => drupal_get_path('module', 'my_module') . '/my_javascript.js', 'type' => 'file', ); Then, within that attached javascript file, I used... document.getElementById("edit-submitted-name-of-organisation").disabled = true; The reason why I ...


0

A contrib module isn't required. $form['field_domain_access']['your_option_key']['#disabled' => TRUE];


2

These scripts are added by the core module BigPipe. If you want to remove them from a specific page then add the option _no_big_pipe to the route: $route->setOption('_no_big_pipe', TRUE); See https://www.drupal.org/docs/drupal-apis/routing-system/altering-existing-routes-and-adding-new-routes-based-on-dynamic-ones


1

I just found a solution. I probably didn't explain it well, so there was no answer. I hope that the solution to the problem I had will better explain the situation I was in. function external_usa_list_webform_options_external_countries_alter(array &$options, array &$element) { // Load cached options. if ($cache = \Drupal::cache()->get('...


Top 50 recent answers are included