1

I have a node with four timefields. When I want to edit the node, all the timefields, except the first one (that has a default value), are blank.

I found this issue still doesn't solved: https://www.drupal.org/node/1970252

How can I solve this? I could populate the missing fields via javascript?

Altenatives of timefield module?

closed as too broad by Mołot, Scott Joudry, Geoff, Krishna Mohan, Yusef Mohamadi Oct 13 '15 at 8:10

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I'm afraid I'm going to have to vote for closure here. There's a number of different things that could cause this and we're not given any indication of what might be the cause (e.g. did this start to happen after a certain module install? is there things causing DB corruption? did this happen after cloning your environment?) – Shawn Conn Sep 11 '15 at 17:55
  • Added small patch to fix: drupal.org/node/1970252 – Ponzio Pilato Mar 2 '16 at 13:03
2

Some of the starting pointers I can think of.

  1. Ensure there is no custom code altering the form field. Search for hook_form_alter/hook_form_FORM_ID_alter in your custom modules.

  2. Check your drupal error logs, if there is any error log related to timefield.

  3. Check your browser console, if there is a JS error.

  4. Check the timefields module issue queue if there is already such error reported, that would be the best place to start from.

  5. Try installing timefields module on vanilla drupal and check if the same issue persist, in that case add this in the issue queue of module.

  6. Make sure all timefields get data when saved for first time, debug using devel module,go to 'devel/php' page and run dpm(node_load('your_node_id'));, see inside node object if those fields have value or not.

  7. "Like s there anyway the possibility to keep the values of the fields somewhere, so I could populate the missing fields via javascript?" Yes, you can only if field values are getting saved to database, in fact simple would be to do at php level something like

    function my_module_form_alter($form, &$form_state, $form_id) {
      if($form_id == 'your_form_id') {
        if(isset($form[#node]->nid)) {
          $form['yourtime_field']['#default_value'] = $form['#node']->yourtime_field['und'][0]['value'];
        }
      }
    }
    

But this is not the solution, this will be re-attempt of what drupal already trying to do. Best would be to identify why values are not showing by default.

Not the answer you're looking for? Browse other questions tagged or ask your own question.