The form_builder_positions() function has some curious code for setting $form['#action'] based on the value of $_GET['destination'].
In Drupal 7 at least, I can confirm that this leads to a bug. For example, if you use the Form Builder Examples module and go to form-builder-example?destination=node, you'll find that if you rearrange the fields and go to the Export tab, your changes do not stick. That's because the JavaScript code winds up submitting the form to the wrong URL ('node'), where Drupal does not know how to build the form.
The above is an artificial example, but we're seeing this in reality in Webform Alt UI, where you wind up with a contextual link that takes you directly to the page where you can use form builder to edit the webform fields. If you go to the form via that route, you are unable to successfully reorder the elements of your form.
Based on the above, I wrote the attached patch which simply removes this code. This means that AJAX will always try to submit the form at the URL at which it was originally built (i.e., the Form API default), which as far as I can tell is always what we want. The explanation in the code comment of why we want something different didn't really make sense to me.... However, I'm quite sure it was put there for a reason, so I'd be interested to hear if there's something that it will break :) I haven't tested Drupal 6 yet, so maybe it's something that is required only there?
| Comment | File | Size | Author |
|---|---|---|---|
| form-builder-positions-destination.patch | 721 bytes | David_Rothstein |
Comments
Comment #1
quicksketchI think you're right here. Previously I think that the positions form was not on the same page as the form preview, it lived at a different URL and was pinged from the preview form to update each field value. In any case removing it doesn't have any effect that I can see, so I've taken it out of both branches.