When clicking any term name from taxonomy tree, the form rebuild is ran.
All validation handlers are called even if they are not necessary, considering that we are just switching the term that is viewed.

As an example consider that we have a required field which is not completed (data being populated with some import scripts). Once we entered a term we cannot switch to another, until that required field is not empty.

Update1:
Same issue when you are trying to search another term and you already have a term opened with a required field that is empty.

Comments

Cracu’s picture

Please test and review this patch.

Instead of:

$form['load-tid-submit'] = array(
    '#type' => 'submit',
    '#value' => 'load term',
    '#submit' => array('taxonomy_manager_load_tid_submit'),
    '#ajax' => array(
      'callback' => 'taxonomy_manager_term_data_form_ajax_callback',
      'method' => 'replaceWith',
      'event' => 'click',
      'wrapper' => 'taxonomy-term-data-replace',
    ),
    '#suffix' => '</div>',
  );

I used:

$form['load-tid-submit'] = array(
    '#type' => 'submit',
    '#value' => 'load term',
    '#submit' => array('taxonomy_manager_load_tid_submit'),
    '#limit_validation_errors' => array(
      array('load-tid'),
    ),
    '#ajax' => array(
      'callback' => 'taxonomy_manager_term_data_form_ajax_callback',
      'method' => 'replaceWith',
      'event' => 'click',
      'wrapper' => 'taxonomy-term-data-replace',
    ),
    '#suffix' => '</div>',
  );
Cracu’s picture

Issue summary:View changes

Corrected description.

Cracu’s picture

The same problem occurs when you are trying to search for a new term while having a term already opened and a required field is empty.

Adding another patch to fix both problems.

Cracu’s picture

Additional fixes added for particular scenarios.

Cracu’s picture

Issue summary:View changes

more issues detected.

interdruper’s picture

Issue summary:View changes
Status:Active» Reviewed & tested by the community

Patch #2047517-3: Validation is called when terms are selected in tree. worked for me.
The bug was specially annoying when reviewing taxonomy terms...

devad’s picture

Status:Reviewed & tested by the community» Needs work

Patch #3 kinda works, however validation is called on selected term form even if we choose some other action to perform which is not connected with selected term while selected term form is still visible (add new term, delete some other existing term...).

So, it is required to close term form before we move to other actions, otherwise add or delete action will fail if selected term form contains any validation-fail field.

Way to reproduce:

1. Add requested field into vocabulary (admin interface).
2. Create term (taxonomy manager interface).
3. Click on term name to make it's form visible on the right (empty requested field is displayed as well).
4. Try to add/delete another term.
5. Add/delete action fails because selected term's form validation is unnecessary called and requested field is empty.

Failed action permanently breaks some parts of taxonomy manager interface as well (action buttons design, etc).

Status changed to -> "Needs work".