Skip to main content
improved formatting
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

So I am using hook form alteruse hook_form_alter() to updatealter a field like below.

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}
function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

ThisIt changes the field value to new value, but the problem is that, as soon as I enable this module all other JS, the JavaScript on forms stops working. For example dropdownsdrop-downs, autocompletesautocomplete, ajax it allAJAX no longer works.

I cant understand what cause this.

Thanks

Update: removed syntax error

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: removed syntax error

I use hook_form_alter() to alter a field.

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

It changes the field value to new value, but the problem is that, as soon as I enable this module, the JavaScript on forms stops working. For example drop-downs, autocomplete, AJAX no longer works.

I cant understand what cause this.

added 8 characters in body
Source Link
May
  • 163
  • 1
  • 10

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: Syntaxremoved syntax error

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: Syntax error

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: removed syntax error

added 26 characters in body
Source Link
May
  • 163
  • 1
  • 10

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == my_form'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: Syntax error

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == my_form) {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

So I am using hook form alter to update a field like below

function mymodule_form_alter(&$form, &$form_state) {
  if ($form['#id'] == 'my_form') {
    $form['my_field']['#value'] = 'New value';
  }
}

This changes the field value to new value, but the problem is that as soon as I enable this module all other JS on forms stops working. For example dropdowns, autocompletes, ajax it all no longer works.

I cant understand what cause this.

Thanks

Update: Syntax error

Source Link
May
  • 163
  • 1
  • 10
Loading