Skip to main content

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value']$form["field_accounts"][LANGUAGE_NONE][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority of cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority of cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"][LANGUAGE_NONE][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority of cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

edited body
Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority ifof cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority if cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority of cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

added 131 characters in body
Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there'sthere are actually one2 more levellevels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['#default_value']$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), hence the need to access the value by referring to an indexand under each of the languagethose is in array for the various different field columns. In the majority if cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there's actually one more level of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), hence the need to access the value by referring to an index of the language array.

Hope that helps

Assuming that your form alter function is actually running (which you can confirm with that call to dsm()), there are actually 2 more levels of array you need to go down to in order to get to the field element:

$form["field_accounts"]["und"][0]['value']['#default_value'] = $default;

In Drupal 7 you have a an array of values for each language the field has been translated into (so that fields with multiple/unlimited cardinality can be catered for), and under each of those is in array for the various different field columns. In the majority if cases this will be 'value' but not always (for example an image field has a file id column, alt column etc)

Hope that helps

Source Link
Clive
  • 167.9k
  • 19
  • 303
  • 337
Loading