When I try to select HS parent and child in content taxonomy field on user/register page, I get an alert "Received an invalid response from the server".

And consola (in firebug, Mozzilla) says :

http://localhost/jobnetworkfinal/hierarchical_select_json ;
response: <b>Fatal error</b>:  Unsupported operand types in <b>C:\wamp\www\jobnetworkfinal\includes\common.inc</b> on line <b>2845</b>

But when I edit users account, everything works perfect.
My configuration is based on drupal 6.13 , HS 6.x-1.x-dev with patch, and don't have CTools/Delegator installed

CommentFileSizeAuthor
#12 518830.patch3.2 KBwim leers

Comments

WildKitten’s picture

Title: Error when selecting HS parent and child in hierarchical_select_json, without CTools/Delegator installed » "Received an invalid response from the server". on user/register page
Category: bug » support

I tried even this, but it didn't work. When I try to select parent and child while editing user, everything looks like it should. And I don't have any form_alter functions in my own module.
These are the modules that I use:

Administration menu	6.x-1.5
Rotor Banner	6.x-2.2	
Content Profile	6.x-1.x-dev
Content Profile User Registration	6.x-1.x-dev
Date	6.x-2.1
Hierarchical Select	6.x-3.x-dev
me' Aliases	6.x-2.7
Auto Assign Role	6.x-1.x-dev
Automatic Nodetitles	6.x-1.1
Login destination	6.x-2.3
Pathauto	6.x-1.1
Shared E-mail	6.x-1.1
Special menu items	6.x-1.3
Token	6.x-1.12
Upload elements	6.x-1.2
x_contact_option	6.x-dev
Profile role	6.x-1.2
Rules	6.x-1.0
jQuery plugins	6.x-1.8
Views	6.x-2.6

Thank you

Ryan Palmer’s picture

Title: "Received an invalid response from the server". on user/register page » "Received an invalid response from the server" on user/register page - $_POST['hs_form_build_id'] missing

I'm having the same issue when using Content Profile module to expose a partial node form on the user register page.

The issue is with the function hierarchical_select_json(), near L283:

$hs_form_build_id = $_POST['hs_form_build_id'];

$_POST['hs_form_build_id'] is not set in the $_POST array from this form, so the cached data doesn't get retrieved properly and everything else under it goes haywire.

I see that hs_form_build_id gets set from function hierarchical_select_after_build() in the first place. The case in which it does not get set would be when, around L671, both $_POST['hs_form_build_id'] is empty and count($names) returns false. It seems $names is a static variable both returned and reset by _hierarchical_select_store_name(). I did a quick ack and only found static $names; in one place, in _hierarchical_select_store_name().

Can anybody pick up from where I left off? I'm not sure where to go from here.

WildKitten’s picture

I found this , so it seams that there is some bigger problem between Content Profile and Hierarchical Select.

I guess we'll wait for Wim and Fago

wim leers’s picture

This may have fixed it. Could you please give the latest CVS version a try?

WildKitten’s picture

@Wim

You have some syntax error:
Parse error: parse error, expecting `')'' in C:\wamp\www\jobnetworkfinal\sites\all\modules\hierarchical_select\modules\hs_content_taxonomy.module on line 167

and have function hs_content_taxonomy_common_config_form_submit($form_id, $form_state['values'], $content_type_name, $field_name) {.
Think you need to remove ['values'] from $form_state['values']. I'll give it a try without it. :)

EDIT
Nope, i didn't work for user/registration page. And I had to copy files from http://drupal.org/node/342992#comment-1809098, so that I could enable Hierarchical Select Content Taxonomy.

wim leers’s picture

Title: "Received an invalid response from the server" on user/register page - $_POST['hs_form_build_id'] missing » Content Profile causes error in hierarchical_select_json()
Priority: Normal » Critical
liliplanet’s picture

subscribe thx!

Ryan Palmer’s picture

Tried the latest CVS as per #4 and the ZIP files suggested in #5. I still see the same error in Firebug:

<br />
<b>Fatal error</b>:  Unsupported operand types in <b>/Users/rypalmer/Sites/kanalia/site/includes/common.inc</b> on line <b>2831</b><br />
zmove’s picture

I have the same problem, perfectly work when going to /node/add/profile and get the same error when I try to use HS in the same profile node-type embed in the registration form.

/subscribe

WildKitten’s picture

I couldn't wait for HS to work on registration page, so I made workaround, not nice, but it works for me. You can see it here, second file. I also made it work with cck content multigroup.

lonestar790’s picture

I have had the same problem with the HS and the node as profile. It has also shown up in Ubercart with one menu. All my other node types are working fine using the HS. I have found that it has degraded in the last version after users did some beta testing for me. The HS worked for a few entries and then stopped error "Received an invalid response from the server".

Firebug does also kick back:

500 Internal Server Error
1.13s jquery.js?w (line 13)
POST http://www.*******.org/hierarchical_select_json

500 Internal Server Error
969ms jquery.js?w (line 13)
ParamsHeadersPostPutResponseCacheHTMLJSON
Response Headers
Request Headers

{ "cache": [ ], "output": "\x3cdiv class=\"form-item\" id=\"edit-taxonomy-4-wrapper\"\x3e\n \x3clabel
for=\"edit-taxonomy-4\"\x3eGeneral Categories: \x3c/label\x3e\n \x3cdiv class=\" hierarchical-select-wrapper
hierarchical-select-level-labels-style-none\" id=\"hierarchical-select-20-wrapper\"\x3e\x3cdiv class
=\"hierarchical-select clear-block\"\x3e\x3cdiv class=\"selects\"\x3e\x3cselect name=\"taxonomy[4][hierarchical_select
][selects][0]\" class=\"form-select\" id=\"edit-taxonomy-4-hierarchical-select-selects-0\" \x3e\x3coption
value=\"none\" class=\"\"\x3e\x26lt;none\x26gt;\x3c/option\x3e\x3coption value=\"5\" class=\"has-children
\" selected=\"selected\"\x3eLiterary\x3c/option\x3e\x3coption value=\"3\" class=\"has-children\"\x3eVisual
\x3c/option\x3e\x3coption value=\"4\" class=\"has-children\"\x3eMusic\x3c/option\x3e\x3coption value
=\"2\" class=\"has-children\"\x3ePerforming Arts\x3c/option\x3e\x3c/select\x3e\x3cselect name=\"taxonomy
[4][hierarchical_select][selects][1]\" class=\"form-select\" id=\"edit-taxonomy-4-hierarchical-select-selects-1
\" \x3e\x3coption value=\"label_1\" class=\" level-label\" selected=\"selected\"\x3e\x3c/option\x3e\x3coption
value=\"51\" class=\"has-no-children\"\x3eCreative Non-Fiction\x3c/option\x3e\x3coption value=\"52\"
class=\"has-no-children\"\x3eFiction\x3c/option\x3e\x3coption value=\"53\" class=\"has-no-children\"
\x3eNon-Fiction\x3c/option\x3e\x3coption value=\"54\" class=\"has-no-children\"\x3ePlaywright\x3c/option
\x3e\x3coption value=\"55\" class=\"has-no-children\"\x3ePoet\x3c/option\x3e\x3coption value=\"46\" class
=\"has-no-children\"\x3ePoetry\x3c/option\x3e\x3coption value=\"50\" class=\"has-no-children\"\x3eCopy
Writer\x3c/option\x3e\x3coption value=\"56\" class=\"has-no-children\"\x3eScreenwriter\x3c/option\x3e
\x3c/select\x3e\x3c/div\x3e\x3cinput type=\"submit\" name=\"op\" id=\"edit-taxonomy-4-hierarchical-select-dropbox-add
\" value=\"Add\" class=\"form-submit add-to-dropbox\" /\x3e\n\x3c/div\x3e\x3cdiv class=\"dropbox\"\x3e
\x3ctable\x3e\x3ccaption class=\"dropbox-title\"\x3eAll selections\x3c/caption\x3e\x3ctbody\x3e\x3ctr
class=\"dropbox-entry first last dropbox-is-empty\"\x3e\x3ctd\x3eNothing has been selected.\x3c/td\x3e
\x3c/tr\x3e\x3c/tbody\x3e\x3c/table\x3e\x3c/div\x3e\x3cdiv class=\"nojs\"\x3e\x3cinput type=\"submit
\" name=\"op\" id=\"edit-taxonomy-4-nojs-update-button\" value=\"Update\" class=\"form-submit update-button
\" /\x3e\n\x3cdiv class=\"help-text\"\x3e\x3cspan class=\"warning\"\x3eYou don\'t have Javascript enabled
.\x3c/span\x3e \x3cspan class=\"ask-to-hover\"\x3eHover for more information!\x3c/span\x3e But don\'t
worry: you can still use this web site! You have two options:\x3cdiv class=\"item-list\"\x3e\x3cul class
=\"solutions\"\x3e\x3cli class=\"first\"\x3e\x3cspan class=\"highlight\"\x3eenable Javascript\x3c/span
\x3e in your browser and then refresh this page, for a much enhanced experience.\x3c/li\x3e\n\x3cli class
=\"last\"\x3e\x3cspan class=\"highlight\"\x3eclick the \x3cem\x3eUpdate\x3c/em\x3e button\x3c/span\x3e
every time you want to update the selection, or when you\'ve checked some checkboxes for entries in
the dropbox you\'d like to remove.\x3c/li\x3e\n\x3c/ul\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div
\x3e\n\x3c/div\x3e\n", "log": null }

Any help would be greatly appreciated. Thanks a bunch. This a GREAT item that would be the perfect solution.

wim leers’s picture

Category: support » task
Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new3.2 KB

drupal24 posted a comment in another issue concerning this issue. Basically, the patch for that issue (which was for D5) seems to solve the problem in this issue as well.

I've made it into a proper patch. drupal24 and others, please try this patch and I'll commit it :)

foodbo’s picture

Category: task » support
Priority: Normal » Critical
Status: Needs review » Active

subscribe thx!

foodbo’s picture

Category: support » task
Priority: Critical » Normal
Status: Active » Needs review

oops.... subscribe again!!

wim leers’s picture

Please give the patch a try, foodbo :) See http://drupal.org/patch/apply.

ari-meetai’s picture

Subscribing after finding the error:

Parse error: syntax error, unexpected '[', expecting ')' in C:\Users\Ari\Documents\work\Penta Services\AVEI\wwwroot\home\sites\all\modules\hierarchical_select\modules\hs_content_taxonomy.module on line 167

Basically this is the same problem found in #5. It seems we're talking about two different topics here.

This happened after upgrading to the last -dev (18 Aug).

Went to apply the patch in #12; didn't matched completely(using Eclipse's "Apply patch") against hierarchical_select-6.x-3.x-dev of 18 Aug.

The syntax error is still there. I'm also using Content Profile. This seems critical.

wim leers’s picture

ari-meetai’s picture

Status: Needs work » Needs review

ok. Went there, did that... Now it's working.

Please, confirm that in the current state HS handles well two Taxonomy fields in one form. It doesn't work for me. The second field doesn't save the values. I recall seeing this somewhere but can't find it now. Thanks.

EDIT: Got it now (almost completelly) working using a combination of patches and commits. The CVS from Aug 18 doesn't work for me at all.

digi24’s picture

Status: Needs review » Needs work

This is not specific to #12 it also applies to the logic in the current CVS:

   // Store the hs_form_build_id in a hidden value, so that it gets POSTed.
@@ -746,7 +747,7 @@ function hierarchical_select_after_build
   // the associated values from the cache. The _hierarchical_select_submit()
   // must be the first submit callback to ensure that it's executed: if a
   // submit callback before it performs a drupal_goto(), it won't be called!
-  $form_state['hs_form_build_id'] = $_POST['hs_form_build_id'];
+  $form_state['hs_form_build_id'] = $post_hs_form_build_id;
   $form['#submit'] = (is_array($form['#submit'])) ? $form['#submit'] : array();
   $form['#submit'] = array_merge(array('_hierarchical_select_submit'), $form['#submit']);
 

I think we should be using $hs_form_build_id instead of $post_hs_form_build_id.

Jason Ruyle’s picture

I'm getting this same error and do not use content profile.
It started happening after upgrading to the dev version around the 18th.

I did run both patches in the order specified (I do have content_taxonomy).

Invalid response from server

As I was writing this post and trying to get the errors the system started to work

This is really weird. I've flushed the cache, ran drush refresh, etc. I was still getting this error, I went into firebug -> console to read out the errors, and started to click on the different terms dropdowns, and all of a sudden the queries started to take a long time. So I clicked results, and it displayed. After that, each time I ran it with console open, it started running slow. I closed console and reloaded the page. The HS ran fine.

I wonder if HS data that it processes is being stored in a weird fashion that doesn't get flushed. Or maybe there is a firebug addon that is an issue. I have firebug with drupalforfirebug, firebug cookie, firebug speedtest.

The one that has changed since is I installed the firebug episodes.

cristhian’s picture

Something similar happened to me and I solved it by this way:

On the line 326 of hierarchical_select.module (function hierarchical_select_json()), there is this:

// Retrieve and process the form.
$form = call_user_func_array('drupal_retrieve_form', $storage['parameters']);

In drupal_retrieve_form, you have this:

$form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);

Where $callback = 'node_form'.. but for some reason it wasn't included that function (stored in node.pages.inc).. and your form stays blank then drupal falls when hierarchical select calls drupal_render after that (common.inc, line 2845), so this is what I did in hierachical_selec.module (line 326), and it solved the problem:


// Retrieve and process the form.
module_load_include('inc', 'node', 'node.pages');
$form = call_user_func_array('drupal_retrieve_form', $storage['parameters']);

Maybe you could think this happened because I called the form with ajax, but the problem wasn't in the form generation, but in the hierarchical json callback. So maybe there should be a way for hierarchical select to decide when to include that misssing file..

kpaul’s picture

dude, you are the bomb. heh.

was having same symptoms when trying to include the form in a block. worked ok if i was on /node/add page, but got this error elsewhere. adding #21 got it working...

thanks!
kpaul

wim leers’s picture

Status: Needs review » Postponed (maintainer needs more info)

I took the time to build a site to test this. It worked out-of-the-box (without any patches) with HEAD. I'm using Taxonomy and not Content Taxonomy though.

I tested with both version 1.0 beta 4 and the latest code in the DRUPAL-6--1 branch.

Please update to the latest version of HS and possibly update Content Profile and report back.

boneless’s picture

I had the same problem as above (Invalid response from server) when ever I had more than 5 hierarchical taxonomy select fields on one page, now using 6.x-3.x-dev from 30/9/09 ans issue seems fixed!
Great work, really nice module!

wim leers’s picture

Status: Postponed (maintainer needs more info) » Fixed

Excellent :)

Status: Fixed » Closed (fixed)

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

crea’s picture

subscribing