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
2
votes
2 answers

How remove node ID [nid:n] in NodeReference fields

This is the same question of this link: Removing [nid:n] in nodereference autocomplete According with the first answer (Grayside) I've created my own module and activated. Then I create a new content, I look sth up in the nodereference field and…
Snazzy
  • 21
  • 2
2
votes
2 answers

How do I theme Form API buttons in Drupal?

The default output from Drupal's Form API is: How do I theme that so I get:
larssg
  • 5,385
  • 3
  • 21
  • 23
2
votes
1 answer

Drupal CCK field type with complex fAPI child fields

This question is basically a follow-up to this one: Drupal Custom CCK field with multiple child fields I need to build a CCK field type that stores several pieces of data, and fAPI form elements to accept the input for each piece of data already…
2
votes
3 answers

How to include drupal form elements in a data table

I have a data table which is populated with data unrelated to drupal content (from a third party system). The data relates to photos which must be approved / flagged as inappropriate. So I'm writing a Drupal admin module which should moderate this…
codecowboy
  • 9,835
  • 18
  • 79
  • 134
2
votes
2 answers

Drupal 7 -- #AJAX Refresh not displaying drupal_set_message errors

The issue: In Drupal 7's Form API, when using #AJAX to refresh fields, error messages from validation are not displayed until the entire page is refreshed. I see the field I refreshed highlighted in the error state, but the user does not see the…
Atomox
  • 512
  • 5
  • 15
2
votes
3 answers

Drupal Form API : display the same form again with AJAX, but with different values, on submit

this is my first post on Stackoverflow, after reading perhaps hundreds of thoughtful questions and no less useful answers. My point is, today, I never found an (even dirty) way to do what I intend to do, and never managed to find an answer, although…
Jivan
  • 21,522
  • 15
  • 80
  • 131
2
votes
1 answer

How can I display an error message if comment body text is not valid?

I am using MYMODULE_form_comment_form_alter to check comment's body text and I have a validation function: function MYMODULE_form_comment_form_alter(&$form, &$form_state, &$form_id){ $form['#validate'][] =…
1
vote
2 answers

how can I get to show the form in drupal and get the wildcard variable as well

I have a menu item like this: $items['property/edit/%'] = array( 'page callback' => 'drupal_get_form', 'page arguments' => array('property_edit_view',2), 'access arguments' => array('access property edit page'), 'type' =>…
Maverick
  • 2,738
  • 24
  • 91
  • 157
1
vote
1 answer

drupal 6 radios button group checked attribute

I know it might be a very simple solution for this, but I am struggling to achieve it. I need to add a checked attribute in one of the two radio buttons of the same group. Here is my code: $options =…
Maverick
  • 2,738
  • 24
  • 91
  • 157
1
vote
1 answer

Drupal 7 : Getting the values from radio buttons form api

So this is my form : $active = array(0 => t('Poster'), 1 => t('Postcard'), 2=>t('Post it')); $form['radioimage']['active'] = array( '#type' => 'radios', '#default_value' => isset($node->active) ? $node->active : 1, '#options' => $active, ); I…
Vishal Khialani
  • 2,557
  • 6
  • 38
  • 49
1
vote
1 answer

Create Drupal Form in Table

I try to create a table where a row is looking like this: |Text1|Text2|Button1| As soon as the user clicks on the button I want to exchange the Button1 with tow textFields and another button... so a normal AJAX-request. I've tried to implement…
Stefan
  • 1,007
  • 1
  • 11
  • 32
1
vote
1 answer

Why is the drupal 6 status message not showing what fields are required when I first submit the form

When I submit the form without filling in one of the required fields( or any combination of required fields) there is no status message presented to let me know I have missed the required fields. The second time I submit the form the status message…
JPK
  • 45
  • 1
  • 6
1
vote
2 answers

How to list a form's field-names

I have a form, and want to generate a list of the form's field-names. Here is how I currently do it: $fieldnames = array(); foreach ($form as $key=>$val){ if (substr($key, 0, 6) === 'field_'){ $fieldnames[] = $key; } } Is there a…
moondog
  • 1,537
  • 5
  • 22
  • 34
1
vote
1 answer

Drupal 6, Create a form in a node which save data to another content type (cck)

I need to create a form in the view (not in the edit) of a content type A. This form need to submit the data to a content type B. I notice that node/
Segolas
  • 575
  • 2
  • 10
  • 26
1
vote
3 answers

Drupal wizard form: Validation and previous button

In my drupal6 site I have wizard form. I implemented it with FormAPI using form storage and the rebuild property. My form validation is being done with the #required property and with functions in the #element_validate property. It's working fine…
Luiz Guilherme
  • 1,601
  • 21
  • 37