If a form is to be posted to some external url (like paypal.com) then there is no point in having fields for form_build_id, form_id and form_token as only the original form will be able to utilise them.
With this patch, if #action is customised then these fields are omitted.
| Comment | File | Size | Author |
|---|---|---|---|
| external-form.patch | 1.59 KB | jbrown |
Comments
Comment #1
jbrown commentedAny thoughts on this?
Comment #2
jbrown commentedexternal-form.patch queued for re-testing.
Comment #3
Stewx commentedAny more info on this?
Comment #4
hibersh commentedhttp://api.drupal.org/api/drupal/includes--form.inc/function/form_state_...
Comment #5
jbrown commentedThat's totally different - I want form_build_id, form_id and form_token to be absent from the HTML for forms that are not going to be submitted back to Drupal.
The function you mention above is for cleaning these values from a form_state once the form has been submitted.
Comment #6
jbrown commentedexternal-form.patch queued for re-testing.
Comment #8
glennpratt commentedWhy not tie the removal to this conditional?
Overloading on #action may not be what the user intended, but setting #token to FALSE is pretty clear.
Comment #9
Chris Gillis commentedI need to do precisely that on a Drupal 7 site. Anyone have feedback on a workaround I can use that doesn't require a patch of core?
Comment #10
Chris Gillis commentedWorkaround:
and to get rid of "op":
Comment #11
wouters_f commenteda little off topic, (drupal 7)
To remove the form_id and form_build_id from the form to external url's "#after_build" did not do it for me.
"#pre_render" did the trick (drupal 7).
Comment #12
sunIf you have this special use-case, then you can set those internal/hidden form elements to #printed TRUE or #access FALSE.
A customized #action does not automatically mean that the form does not submit to Drupal anymore.
Comment #13
ankithashettyIf I unset the
form_idI get an error