using
/subform-example/multiple-nodes link and added Datestamp field type to node the field itself stays empty after saving node

When field Datestamp is required - form validation error without any possibility for saving it

The same problem with a custom code using subform api as described in documentation

Comments

podarok’s picture

Datestamp field created using date module

  $node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => 'product_display', 'language' => 'und');


    $form['subform']['node'] = array(
      '#type' => 'subform',
      '#subform_id' => 'node_form',
      '#subform_file' => array('module' => 'node', 'name' => 'node.pages'),
      '#subform_arguments' => array(clone $node),
      //'#subform_default_triggering_element' => array('actions' => 'submit'),
      '#required' => TRUE,
    );

date field

 // Exported field: 'node-product_display-field_date_stamp'
  $fields['node-product_display-field_date_stamp'] = array(
    'field_config' => array(
      'active' => '1',
      'cardinality' => '1',
      'deleted' => '0',
      'entity_types' => array(),
      'field_name' => 'field_date_stamp',
      'foreign keys' => array(),
      'indexes' => array(),
      'module' => 'date',
      'settings' => array(
        'granularity' => array(
          'day' => 'day',
          'month' => 'month',
          'year' => 'year',
        ),
        'repeat' => 0,
        'timezone_db' => '',
        'todate' => 'required',
        'tz_handling' => 'none',
      ),
      'translatable' => '1',
      'type' => 'datestamp',
    ),
    'field_instance' => array(
      'bundle' => 'product_display',
      'deleted' => '0',
      'description' => '',
      'display' => array(
        'default' => array(
          'label' => 'inline',
          'module' => 'date',
          'settings' => array(
            'format_type' => 'long',
            'fromto' => 'both',
            'multiple_from' => '',
            'multiple_number' => '',
            'multiple_to' => '',
            'show_repeat_rule' => 'show',
          ),
          'type' => 'date_default',
          'weight' => '4',
        ),
        'full' => array(
          'label' => 'inline',
          'module' => 'date',
          'settings' => array(
            'format_type' => 'long',
            'fromto' => 'both',
            'multiple_from' => '',
            'multiple_number' => '',
            'multiple_to' => '',
            'show_repeat_rule' => 'show',
          ),
          'type' => 'date_default',
          'weight' => '1',
        ),
        'teaser' => array(
          'label' => 'above',
          'settings' => array(),
          'type' => 'hidden',
          'weight' => 0,
        ),
      ),
      'entity_type' => 'node',
      'field_name' => 'field_date_stamp',
      'label' => 'Date stamp',
      'required' => 0,
      'settings' => array(
        'default_format' => 'medium',
        'default_value' => 'now',
        'default_value2' => 'strtotime',
        'default_value_code' => '',
        'default_value_code2' => '+1 day',
        'user_register_form' => FALSE,
      ),
      'widget' => array(
        'active' => 1,
        'module' => 'date',
        'settings' => array(
          'increment' => '1',
          'input_format' => 'd/m/Y - H:i:s',
          'input_format_custom' => '',
          'label_position' => 'above',
          'repeat_collapsed' => 0,
          'text_parts' => array(),
          'year_range' => '-3:+3',
        ),
        'type' => 'date_popup',
        'weight' => '3',
      ),
    ),
  );
podarok’s picture

Project: Subform » Date
Version: 7.x-1.x-dev » 7.x-2.0-alpha3
KarenS’s picture

Status: Active » Fixed

If you're using alpha3, move up to the latest -dev version of 7.2.

podarok’s picture

Version: 7.x-2.0-alpha3 » 7.x-2.x-dev
Status: Fixed » Active

moved to latest dev - the same problem exists

KarenS’s picture

Project: Date » Subform
Version: 7.x-2.x-dev » 7.x-1.x-dev

I don't know anything about subform, I can't fix this.

casey’s picture

Fixed it. Try latest dev version and please let me know if it works.

casey’s picture

Problem was that date_popup_process_date_part() sets #input to FALSE while subform.module was checking for it to see if #name rewriting is needed. Replaced the check for #input with !empty(#name).

podarok’s picture

are there any patches for that?

podarok’s picture

podarok’s picture

Status: Active » Fixed

thanx!
fixed! latest dev

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.