Skip to main content
Found a better function to call
Source Link
iStryker
  • 4.5k
  • 2
  • 24
  • 44

after you save it, it saves the value of the checkbox as #value (not #default_value).

Sometimes to setWhen defining the default value I do thisfield settings: (pulled from D7 cck_table.module)

  $form['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => t('Specify a class to be added to the table element.'),
    **'#default_value' => isset($field['css_class']) ? $field['css_class'] : '',**
  );

I don't know ifRevised:

More likely you would want to do this helps. Please let me know:

If you want to grab the default values, you can call `field_info_field($field_name

Returns data about an individual field, given a field name.

after you save it, it saves the value of the checkbox as #value (not #default_value).

Sometimes to set the default value I do this

  $form['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => t('Specify a class to be added to the table element.'),
    **'#default_value' => isset($field['css_class']) ? $field['css_class'] : '',**
  );

I don't know if this helps. Please let me know

after you save it, it saves the value of the checkbox as #value (not #default_value).

When defining the field settings: (pulled from D7 cck_table.module)

  $form['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => t('Specify a class to be added to the table element.'),
    **'#default_value' => isset($field['css_class']) ? $field['css_class'] : '',**
  );

Revised:

More likely you would want to do this:

If you want to grab the default values, you can call `field_info_field($field_name

Returns data about an individual field, given a field name.

Source Link
iStryker
  • 4.5k
  • 2
  • 24
  • 44

after you save it, it saves the value of the checkbox as #value (not #default_value).

Sometimes to set the default value I do this

  $form['css_class'] = array(
    '#type' => 'textfield',
    '#title' => t('CSS Class'),
    '#description' => t('Specify a class to be added to the table element.'),
    **'#default_value' => isset($field['css_class']) ? $field['css_class'] : '',**
  );

I don't know if this helps. Please let me know