Closed (fixed)
Project:
Hierarchical Select
Version:
5.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Nov 2009 at 09:23 UTC
Updated:
28 Feb 2010 at 18:59 UTC
I have several HS fields in a content type. When trying to create a new node of this content type and if there's a validation error because a required field is not filled and then tried to update a HS field, all HS fields are changed at once.
The reason I found is that in hierarchical_select.js, response.output is returned null in below code part and thus change all HS fields in the document.
// Replace the old HTML with the (relevant part of) retrieved HTML.
$('#hierarchical-select-'+ hsid +'-wrapper', Drupal.HierarchicalSelect.context)
.html($('.hierarchical-select-wrapper > *', $(response.output)));
On the server side, this happens because the following condition becomes false after the form resubmission and server cache is not updated after new HS fields are created.
function hierarchical_select_after_build($form, $form_values) {
$names = _hierarchical_select_store_name(NULL, NULL, TRUE);
$post_hs_form_build_id = _hierarchical_select_get_hs_form_build_id();
if (!isset($post_hs_form_build_id) && count($names)) {
$parameters = (isset($form['#parameters'])) ? $form['#parameters'] : array();
-Laknath
Comments
Comment #1
wim leers