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
1
vote
1 answer

Drupal 7 user registration custom

I'm trying to add custom fields to the user registration form. I need to save 2 of them into the Drupal User's database and 1 into my own separate database. I'm using hook_form_alter to add the fields and then hook_form_submit to save the…
Exziled
  • 473
  • 5
  • 20
1
vote
6 answers

Most efficient way to have a 50 state drop down box in Drupal Forms

I know that one way is to have a table in database with all the states and then you would read it in your form. Is there any easier way in your opinion guys ? I feel bad asking for something like this since it is so elementary however I would…
user363036
  • 319
  • 1
  • 2
  • 7
1
vote
2 answers

Drupal Studs help me with my form_alter hook ( I am almost there)

So I think I am almost there conceptually but need some missing pointers. Objective is to add a few more fields to the normal user registration form, style it a little, then submit it with storing the extra fields in a table. This is what I have so…
user363036
  • 319
  • 1
  • 2
  • 7
1
vote
3 answers

How to use hook alter form in module to register a user and also save some data in another table?

have a general idea on how to use hook alter to modify the feel of the registration form . However the challenge I have is to not only have the user register, but to save some extra data into another table and then redirect user to a new page. How…
user363036
  • 319
  • 1
  • 2
  • 7
1
vote
1 answer

form_set_error on taxonomy fields?

While form_set_error('field_firstname', t('message')); works fine, how can I do the same for one of several taxonomy fields? e.g. form_set_error('taxonomy[5]', t('message')); (which doesn't work). Can anyone help?
stephenhay
  • 2,824
  • 24
  • 25
1
vote
2 answers

Registration during content creation in Drupal?

Is there an easy way to allow a user to register as he creates content type. E.g. Let's say there is a content type called "listing". When the user clicks to on a link to create it, and he's not logged in, I want a "register" box to appear ABOVE THE…
rockstardev
  • 13,479
  • 39
  • 164
  • 296
1
vote
3 answers

Drupal FAPI: Add form elements on nodeform after validation

I use Drupal 6.x. In my own module I alter each node form an add my own validation handler to it using $form['#validate'][] = 'my_own_validation_function'; Then I have the function function my_own_validation_function($form, &$form_state) { //if…
ManuelBS
  • 58
  • 8
1
vote
1 answer

Drupal: how to set collapsed property for edit-content fields

is there any interface to decide which fields should be collapsed and which ones not in content pages ? i.e. Tags is collapsed Menu Settings is expanded, Authoring is expanded.. I would like the opposite. thanks Updated: Taxonomy super-select field…
aneuryzm
  • 63,052
  • 100
  • 273
  • 488
1
vote
1 answer

Drupal Module Development: How to Communicate between form_submit and page handler functions

I am writing a module and I need to retrieve values set in a form_submit function from a page handler function. The reason is that I am rendering results of a form submit on the same page as the page handler. I have this working, but I am using…
Aaron
  • 3,249
  • 4
  • 35
  • 51
1
vote
3 answers

Getting altered form values in drupal

I created one module in drupal name as newmodule.I use form alter to alter user registration form for adding one field location.When i submit the form, how i can get the value of the new field which i created .
Warrior
  • 5,168
  • 12
  • 60
  • 87
1
vote
2 answers

Apply custom page template to content from Drupal 7 module

I am developing a Drupal module. Part of it opens a pop-up window, displays some elements in it, and uses JavaScript to transfer input back to the main page. As this is a small window, I don't want it to display the full theme borders from the…
1
vote
4 answers

Drupal 6 Forms formatting

I am trying to create a form in drupal 6 that has multiple items on the same line. More specificly, I want a right alligned form what has a textfield, dropdown-box, and button all on the same line. I know how to create the items, but drupal tends to…
Señor Reginold Francis
  • 16,318
  • 16
  • 57
  • 73
1
vote
0 answers

Drupal 7 how to apply custom template to my custom form

I have a module, which includes multistep form. I decided to make one of these steps work like this: free times per employee are rendered as html elements, and when element is clicked, Javascript will apply the value to hidden input field. So I…
1
vote
1 answer

Drupal hook_form_alter weight control

Try to add some additional form items in the new content type add form. Also try to increase the weight of submit and preview there. function mymodule_form_alter(&$form, &$form_state, $form_id){ //add some $form items here …
Allen Chen
  • 133
  • 2
  • 7
1
vote
2 answers

how can i prefix a name to the uploaded file name in drupal 7

how can i prefix a name to the uploaded file name in drupal? Eg: If my uploaded file name is 'example.pdf' after click upload, i want to rename it as 'myprefix_example.pdf'
TeamG
  • 1
  • 2