Questions tagged [drupal-fapi]

The Drupal form API is a very strong, robust, easy and scalable API for creating forms in Drupal.

The Drupal form API is a very strong, robust, easy and scalable API for creating forms in Drupal.

Documentation about the form API can be found on:

Related documentation

196 questions
3
votes
2 answers

Showing form data after submit

I have a form with a submit button and a handler that stores data in the database. Problem is when the form is submitted, all data is cleared from the input fields. Is there a way to still show them after submit? What changes do I need to make to my…
Berming
  • 1,302
  • 4
  • 18
  • 34
3
votes
2 answers

hook_form_submit not being called

I'm trying to submit a form and use hook_form_submit. The problem is the form is displayed via ajax and this results in hook_form_submit not being called. $items['ajaxgetform/%'] = array( 'page callback' => 'ajaxgetform', 'access arguments'…
James Bayliss
  • 107
  • 1
  • 9
3
votes
1 answer

What is the opposite of Access Callback user_is_anonymous?

I know that is used in a drupal module to specify that only anonymous users can see that module. What would be the callback that specifies only logged in users ? I have a page that I only want accessible to logged in users. Thank You
user363036
  • 319
  • 1
  • 2
  • 7
3
votes
1 answer

Why would a Drupal form not be cached in cache_form?

My form, lets call it organize_issue, is a form in a custom module being called from the menu using the page callback drupal_get_form function. The form works perfectly well. I'm trying to implement some AHAH type functionality now, and need to get…
Michael T. Smith
  • 568
  • 3
  • 22
3
votes
3 answers

form layout in drupal from a module

I created my own module called "cssswitch". I'm trying to create my own html layout to display the admin form portion of the module. I understand how to use the hook_form_alter() to modify form elements, but I need to create the entire form layout…
EricP
  • 1,459
  • 6
  • 33
  • 55
3
votes
3 answers

Drupal: adding disclaimer text above the submit button in a webform

Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text above the submit button in a Drupal webform? I can add text below the button, but do not know how to split up the button from the other elements to add text…
james6848
  • 1,657
  • 3
  • 25
  • 39
3
votes
2 answers

How can I set ID attribute for drupal 7 form elements?

I want to set the ID attribute of an element of a form that I'm creating in a module using the form API.
3
votes
2 answers

How do I add two submit buttons to a Drupal 5 form?

I have two submit buttons on my form. One is the normal submit button that calls `my_form_submit` like-ah-so: $form['fieldset']['submit'] = array( '#type' => 'submit', '#value' => 'Show Applications', ); I want to add another button that will…
Jamison Dance
  • 19,896
  • 25
  • 97
  • 99
3
votes
2 answers

create a custom form inside a block in drupal 7

I know how to use a module to create a block and I know how to create a custom form using form api. now, i want to add this custom form inside the block I create.
user1851050
  • 45
  • 2
  • 7
3
votes
2 answers

Drupal 7 FAPI- Adding form elements in validate or submit handlers

Is it possible to add additional form elements in the validate or submit functions in drupal 7 module? The following code works and image is displayed on the form: function test1_form($form, &$form_state) { $form['image']=array( …
Muhammad Qasim
  • 351
  • 1
  • 6
  • 21
3
votes
3 answers

Create multiple CCK nodes with single custom form in Drupal

I need a form which will allow creation of several related nodes at the same time. All of the nodes involve CCK fields. I would like to use as much of CCK's built-in validation, submission, input widget, and security functionality as…
isaac77
3
votes
2 answers

How to programmatically add a form to a node in Drupal 7?

I need to add a programmatic form to a node in Drupal 7. How to attach the form to the node? function addtabexample_form($node, &$form_state) { $type = node_type_get_type($node); $form['title'] = array( '#type' => 'textfield', '#title'…
user1480765
  • 177
  • 3
  • 11
2
votes
2 answers

cannot get checkboxes value using drupal form api

i have form in drupal which uploads images and has got few checkboxes in it. Here is the form: $form['checklist_fieldset'] = array( '#type' => 'fieldset', '#title' => t('Check List'), '#collapsible' => FALSE, '#collapsed' => FALSE, …
Maverick
  • 2,738
  • 24
  • 91
  • 157
2
votes
1 answer

Drupal Form API - Grabbing the array() key->#value

I have a hook_form() and I'm trying to submit the data to the database. When the form options generates, it generates like I'm not trying to get the 'value' of the option. I'm trying to grab the part in-between the…
jwmann
  • 608
  • 10
  • 19
2
votes
1 answer

How do I insert a custom form into a Drupal node view and process the node's data on submission?

We are importing our sales orders from our accounting system into a Drupal 6 site. We setup a content type called orders. I would like to build a shipping module for our shipping provider (no there isnt already one). I understand how to build…
Tim
  • 2,667
  • 4
  • 32
  • 39
1 2
3
13 14