The Examples project has a complete dependent dropdown example in the AHAH Example. If I were you I would copy it and adapt it. <a href="http://drupal.org/project/examples">http://drupal.org/project/examples</a><br><br>-Randy<br>
<br><div class="gmail_quote">On Fri, Feb 18, 2011 at 11:05 PM, Jeff Hartman <span dir="ltr"><<a href="mailto:lists@jeffhartman.com">lists@jeffhartman.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hey list,<br>
<br>
I've got a couple forms that use AHAH functions to generate a drop down of states/provinces based on the user's selection in a country drop down menu.<br>
<br>
I'm using a very similar method as is found here:<br>
<a href="http://drupal.org/node/331941" target="_blank">http://drupal.org/node/331941</a><br>
<br>
One form works fine with fields as $form['country'] and $form['state']. The other form uses fieldsets and those fields get renamed and lose their hierarchy after the form is rebuilt.<br>
<br>
So for example, the following fields start out like:<br>
$form['guest'][1]['country']<br>
$form['guest'][1]['state']<br>
$form['guest'][1]['zip']<br>
<br>
But after the form is rebuilt with form_builder and drupal_render using:<br>
$output = drupal_render($form['guest'][1]['state']);<br>
$output .= drupal_render($form['guest'][1]['zipcode']);<br>
<br>
// Render form output as JSON<br>
print drupal_json(array('data' => $output, 'status' => true));<br>
<br>
The rebuilt fields are logically placed outside of the fieldset and end up as:<br>
$form_state['guest'][1]['country']<br>
$form_state['state']<br>
$form_state['zip']<br>
<br>
Thoughts on what might cause that? Thanks for any direction. I've struggled with this for hours!<br>
<font color="#888888"><br>
Jeff<br>
<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Module and Site Development<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>+1 970.462.7450<br><br>