You need to login to send post. No account yet? Create one:
Create account
Creating custom form in Drupal
Fri, 02/26/2010 - 17:28
In HTML is form just something between <form></form> tags. There, of course, should be some input and form action (script) which will handle input data, like:
<form action="/node/NUMBER/webform-results/download" accept-charset="UTF-8" method="post" id="webform-results-download-form">
<input type="submit" name="op" id="edit-submit" value="Download" class="form-submit" />
<input type="hidden" id="edit-format-excel" name="format" value="excel" />
</form>
But Drupal needs some more authorization yet, so if you want create your own form, simply copy and paste action and inputs you need AND adapt authorization inputs (in bold) in way as you see...
<form action="/node/NUMBER/webform-results/download" accept-charset="UTF-8" method="post" id="webform-results-download-form">
<input type="submit" name="op" id="edit-submit" value="Download" class="form-submit" />
<input type="hidden" name="form_build_id" id="<?php print drupal_get_token('form_build_id'); ?>" value="<?php print drupal_get_token('form_build_id'); ?>" />
<input type="hidden" name="form_token" id="edit-webform-results-download-form-form-token" value="<?php print drupal_get_token('webform_results_download_form'); ?>" />
<input type="hidden" name="form_id" id="edit-webform-results-download-form" value="webform_results_download_form" />
<input type="hidden" id="edit-format-excel" name="format" value="excel" />
</form>


















