Not sure if this is a bug, intended behavior, or just me being stupid after too many hours trying to get this to work, but here's the deal.

I decided to rebuild a somewhat large multipage form using AHAH via this module in order to make the flow/UI a little more intuitive for my users.

The problem I'm running into is that I can't seem to nest any AHAH/javascript elements under the initial AHAH select box.

Here's a quick run down on how the form is supposed to work:

Step 1.) Person selects an industry type (lodging, service, transportation, etc)
This selection produces about 15-20 fields based on which industry is chosen.

In addition there are 1-3 collapsed fieldsets that have additional fields these fieldsets are not working, specifically the collapsing part, left uncollapsed (in the element code) they show the fields they contain, just wont collapse.

Step 2.) Also dependent on the initial select box is a set of 3 (or maybe more) additional select boxes used for locations, region -> state -> city, each one populated by the selection of the previous select box.

Here's where the real trouble starts. I can't even get these additional select boxes to show, let alone work properly.
By nesting the fieldsets (['firstfield']['secondfield']['thirdfield']) i can get the select box to display, but it doesn't have any AHAH functionality, and I get an error about array arguments that seems to point back to the ahah_helper_path having more than 2 arguments.

In short, can you outline a proper way to have multiple fieldset/select box nested inside each other in order to have a multi-tier multi-choice form.
If of course it's possible.

Thanks :)

CommentFileSizeAuthor
#3 ahah_helper_demo.module.zip1.7 KBdmower

Comments

wim leers’s picture

Could you show the code?

wim leers’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)
dmower’s picture

StatusFileSize
new1.7 KB

Heres an example of where the code breaks. I basically modified the ahah module demo and reproduced the problem that way.

Thanks for taking a look

brahms’s picture

@dmower:

I found an error in your modified ahah_helper_demo.module, which is the reason why the second select box did not work. To make it work you have to replace line 97:

if ($form['billing_info']['new_fieldset']['industry'] == 'manuf') {

with:

if ($form_state['values']['billing_info']['new_fieldset']['industry'] == 'manuf') {

Now all three select elements work but there is one remaining error: the submit button is never rendered. I can't find the reason for this, but if you place the button aotside the if condition for the select values (like it is done in the original demo) the button works.

wim leers’s picture

Title: Nested Form Elements » Nested form item not working
Status: Postponed (maintainer needs more info) » Fixed

brahms: that "inner" button should only be used when JS is disabled. Hence the "no-js" class. And that's probably also why you didn't see it :)

dmower: see brahms reply! :)

Status: Fixed » Closed (fixed)

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