I do confirm that <a href="http://drupal.org/node/684846">http://drupal.org/node/684846</a> works with your submit function as is, and it would be nice if you&#39;d chime in on that issue and say so.<br><br>However, this simple fix is probably a better use of the Form API:<br>
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   if ($location-&gt;display_type == &#39;user&#39;) {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-    drupal_goto(&#39;user/&#39; . $location-&gt;display_number . &#39;/weather&#39;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+    $form_state[&#39;redirect&#39;] = &#39;user/&#39; . $location-&gt;display_number . &#39;/weather&#39;;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">   }</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">   else {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-    drupal_goto(&#39;admin/config/user-interface/weather&#39;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+    $form_state[&#39;redirect&#39;] = &#39;admin/config/user-interface/weather&#39;;</span><br><br>-Randy<br><br><div class="gmail_quote">On Fri, Mar 5, 2010 at 8:36 AM, Ken Winters <span dir="ltr">&lt;<a href="mailto:kwinters@coalmarch.com">kwinters@coalmarch.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div style="word-wrap: break-word;"><div>Note that the linked issue is marked critical (so it will be fixed before D7 is released) and already has a patch.  Rather than change your form, first try applying the patch and see if that fixes it for you.</div>
<div><br></div><font color="#888888"><div>- Ken Winters</div></font><div><div></div><div class="h5"><br><div><div>On Mar 5, 2010, at 10:33 AM, Randy Fay wrote:</div><br><blockquote type="cite">Hi Tobias - <br><br>The problem is the drupal_goto() in your submit function. The submit function is being processed during the AJAX callback... and the drupal_goto() takes control away from the callback.<br>
<br>If I&#39;m not mistaken, this behavior will change when <a href="http://drupal.org/node/684846" target="_blank">http://drupal.org/node/684846</a> lands, but for now, you&#39;ll need to not do a drupal_goto() in your submit function.<br>
 <br>-Randy<br><br><div class="gmail_quote">On Fri, Mar 5, 2010 at 4:19 AM, Tobias Quathamer <span dir="ltr">&lt;<a href="mailto:t.quathamer@gmx.net" target="_blank">t.quathamer@gmx.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 Hi all,<br> <br> I&#39;ve run into a problem with D7 and AJAX-enabled forms. What I try to do<br> is to have a selection list use options depending on another selection<br> list. I&#39;ve looked at the code of the AJAX examples module, but I could<br>
 not find why my code is not working. A part of my code follows, the<br> complete code can be found here (lines 356 onwards):<br> &lt;<a href="http://drupalcode.org/viewvc/drupal/contributions/modules/weather/weather.forms.inc?view=markup&amp;pathrev=DRUPAL-7--1" target="_blank">http://drupalcode.org/viewvc/drupal/contributions/modules/weather/weather.forms.inc?view=markup&amp;pathrev=DRUPAL-7--1</a>&gt;<br>
 <br> I&#39;ve separated those function calls into their own file, they are not in<br> the main .module file. Could this be a cause of problems? I would<br> appreciate any hints or pointers.<br> <br> Regards,<br> Tobias<br>
 <br> <br> <br> <br> function weather_location_settings_form($form, &amp;$form_state, $display_type, $display_number, $location_id=NULL) {<br>  $mode = &#39;edit&#39;;<br>  // Handle the addition of a new location.<br>  if ($location_id == &#39;add&#39;) {<br>
    $mode = &#39;add&#39;;<br>    $location_id = NULL;<br>  }<br>  // If the location exists, get the settings. If it does not exist,<br>  // get the default location settings.<br>  $settings = weather_get_location_settings($location_id);<br>
  $settings-&gt;places = weather_get_places($settings-&gt;country);<br>  $form[&#39;country&#39;] = array(<br>    &#39;#type&#39; =&gt; &#39;select&#39;,<br>    &#39;#title&#39; =&gt; t(&#39;Country&#39;),<br>    &#39;#description&#39; =&gt; t(&#39;Select a country to narrow down your search.&#39;),<br>
    &#39;#default_value&#39; =&gt; $settings-&gt;country,<br>    &#39;#options&#39; =&gt; drupal_map_assoc(weather_get_countries()),<br>    &#39;#ajax&#39; =&gt; array(<br>      &#39;callback&#39; =&gt; &#39;weather_location_settings_form_callback&#39;,<br>
      &#39;wrapper&#39; =&gt; &#39;weather_place_replace&#39;,<br>    ),<br>  );<br>  $form[&#39;place&#39;] = array(<br>    &#39;#type&#39; =&gt; &#39;select&#39;,<br>    &#39;#title&#39; =&gt; t(&#39;Place&#39;),<br>    &#39;#description&#39; =&gt; t(&#39;Select a place in that country for the weather display.&#39;),<br>
    &#39;#default_value&#39; =&gt; $settings-&gt;icao,<br>    &#39;#options&#39; =&gt; $settings-&gt;places,<br>    &#39;#prefix&#39; =&gt; &#39;&lt;div id=&quot;weather_place_replace&quot;&gt;&#39;,<br>    &#39;#suffix&#39; =&gt; &#39;&lt;/div&gt;&#39;,<br>
  );<br>  $form[&#39;submit&#39;] = array(<br>    &#39;#type&#39; =&gt; &#39;submit&#39;,<br>    &#39;#value&#39; =&gt; t(&#39;Save&#39;),<br>  );<br>  // Do not show the &#39;delete&#39; button if not in &#39;edit&#39; mode.<br>
  if ($mode == &#39;edit&#39;) {<br>    $form[&#39;delete&#39;] = array(<br>      &#39;#type&#39; =&gt; &#39;submit&#39;,<br>      &#39;#value&#39; =&gt; t(&#39;Delete&#39;),<br>      &#39;#submit&#39; =&gt; array(&#39;weather_location_delete_submit&#39;),<br>
    );<br>  }<br>  return $form;<br> }<br> <br> function weather_location_settings_form_callback($form, $form_state) {<br>  return $form[&#39;place&#39;];<br> }<br> <font color="#888888"><br> <br> --<br> Tobias Quathamer | Quidquid latine dictum sit, altum viditur.<br>
 Hamburg, Germany | (Whatever is said in Latin sounds profound.)<br> <br> </font></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Development, troubleshooting, and debugging<br><a href="mailto:randy@randyfay.com" target="_blank">randy@randyfay.com</a><br>
+1  970.462.7450<br><br></blockquote></div><br></div></div></div></blockquote></div><br><br clear="all"><br>-- <br>Randy Fay<br>Drupal Development, troubleshooting, and debugging<br><a href="mailto:randy@randyfay.com">randy@randyfay.com</a><br>
+1  970.462.7450<br><br>