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

learn more… | top users | synonyms (1)

1
vote
0answers
12 views

ajax form submit in drupal 7

I am doing an ajax form submit, Issue #1 : I am facing problem while submitting the form, The form have a submit and a validate function. In the validate function it is checking whether the username ...
0
votes
0answers
12 views

Dymanic form with ajax

I looked at ajax_example_add_more and I cannot understand what's wrong with my code. It doesn't add another field set. my code: function my_module_form($form, &$form_state) { $form = ...
0
votes
0answers
7 views

Set taxonomy value dependent on another field value in a form

I am having two fields. The first field is a select field based on a List(text) node field prepopulated with values and a second field that is a term reference, select again. I would like to be able ...
1
vote
1answer
23 views

How to change label pass field on registration form

I need to change the password field label on the registration form. Name and Email I changed through hook_form_alter and password does not work. Help me! $form['account']['name']['#title'] = 'Имя ...
0
votes
0answers
12 views

How to log empty AJAX responses?

I have simple form for product filtering, using AJAX. Callback is defined as follows: function mymodule_filter_main_category_ajax($form, $form_state) { return array( '#type' => 'ajax', ...
0
votes
1answer
19 views

How do you add information text to a Drupal 7 form?

I have this: $form['rate_the_room']['room_rating'] = array( '#type' => 'radios', '#title' => 'How would you rate the room you stayed in?', '#options' => array(1 => 1, 2 => 2, 3 ...
0
votes
3answers
27 views

How to examine existing field values and modify other field in hook_form_alter?

I have a content type with a bunch of fields attached. When displaying the node edit form I want to hide or display one field ( using $form['some_field']['#access'] = FALSE; ) if another field has a ...
1
vote
0answers
15 views

Why does managed_file not respect the #upload_location?

I've got a managed_file, with an #upload_location set to 'public://uploads'. When I upload files using the managed_file form element, uploaded files get copied to the 'public://' root, but not the ...
0
votes
0answers
18 views

#limit_validation_errors submit problem

I have a problem using #limit_validation_errors for a submit button on which I dont want all the validations to run. Here's my custom submit button : $form['actions']['draft'] = array( '#type' ...
0
votes
0answers
32 views

Customize “My account” and “Logout” Links in my subtheme with CSS button problem

So I'm trying to shape "My Account" and "logout" links in to my omega 3 subtheme with this css: { -webkit-appearance: none; -moz-border-radius: 11px; -webkit-border-radius: 11px; ...
0
votes
0answers
8 views

block with a from with a custom handler inside a lightbox on page load

I have a custom module that generates a block with a custom form inside, this form has a custom handler where I set some session variables and some other stuff. I need to show that block in a ...
0
votes
0answers
10 views

split result into two fields from autopopulated module in D7

I have a form with 2 fields I have created a module which pre-populates field1 based on what is keyed and what is found in the db. The SQL query is getting 2 columns from the db and I would like the ...
0
votes
0answers
2 views

Add Another Item on Multivalued Field Fails on Custom Form

I have a custom module building a form with fields attached from various nodes using field_attach_form(). However, when I click "Add another item" on a field with unlimited values, a POST request is ...
0
votes
1answer
17 views

hook_form_alter Save $form['account']['field_first_name'] into $form['profile']['field_first_name']

Hi I'm trying to save a field into another field in the same form when the form is submitted. I've tried using hook_form_alter and checked for count($form_state['input']) > 0 to save ...
0
votes
1answer
12 views

Form API Submit Button for Multiple Forms

I created a module with 3 forms on it. Is there a way to only have one submit button at the very bottom of the page that will store all three values?
1
vote
0answers
14 views

Disable past dates in date_combo

Is there a way to disable the past dates in the date pop-up while using the date combo form api? Specifically, I have a date type field in a content type, on which I want to do this. Help ...
3
votes
2answers
48 views

How to adapt #prefix/#suffix for each option in radio form using hook_form_alter()?

I need to modify the html code of radio buttons generated by Ubercart Attributes. So I want to do it using hook_form_alter(). If I dsm() the $form I need to change using hook_form_alter() I get ...
1
vote
1answer
19 views

Sanitizing User Input using Form API - Creating Nodes

I'm using D7 Form API to make some custom forms for users that create nodes on submit (using node_submit & node_save functions). This is an example form I'm using: function ...
0
votes
0answers
6 views

registration form disable required username

I'm using the logintoboggan module, so that users identify with email and password. Everything works fine, with exception of that on the registration form is required to put a user name. It must ...
0
votes
1answer
15 views

Ajax Request Failing

I've got a perplexing issue which has left me quite confused. I've got a form which has a link on it and when the user clicks the link it is supposed to open up an AJAX popup form and display some ...
1
vote
1answer
31 views

Drupal form elements in html table, label (title) rendering

How to place title/label in other cell of the html table I have: function hook_theme() { return array( 'hook_form_table' => array( // The renderable element is the form. ...
0
votes
1answer
30 views

form element ['#attached'] does not load setting

I have this in a form alter hook of a specific node type: $form['title']['#attached']['js'] = array( array( 'data' => drupal_get_path('module', 'mymodule') . '/js/autosuggest.js', ...
0
votes
1answer
31 views

How to make sure my behavior is triggered before AJAX?

I have a form elements that looks like this: $form['properties'][$property->idProperty] = array( '#title' => $property->Label, '#ajax' => array( 'callback' => ...
0
votes
0answers
22 views

Calculate webform total from select list fields

Like e.g. there are two select options type components that has various amounts of $ to select from. So if user selects in one field $100 and $200 then the next field below it would generate the total ...
0
votes
1answer
21 views

Drupal Json Output strange characters when pulling from other language

Hi Fellow drupal experts, I have a problem, I developed a custom page intended to do a drupal json output : and here is the code : function blogpull_menu() { $items = array(); ...
0
votes
0answers
18 views

Displaying custom form on a node page

I have created a form using form-api. I want to show it on a page called career. Anyone having any idea how to do that? Any help will be appreciated..Thank you! Here is my hook_menu() code: function ...
0
votes
1answer
27 views

How can I make a field appears when you check on a checkbox?

I'm making a module and on the administration page there is a form and I want to make one of the fields appears only when user check on a checkbox. Like the option to add a new content to a menu.
0
votes
0answers
30 views

AJAX callback not working on select list added via previous AJAX call

I have a large custom form using the excellent FAPI. A select list element is added through AJAX when a certain option is selected from a previous select list. This is working great, and the select ...
0
votes
0answers
20 views

Print out multiple upload fields on a page

I'm trying to output 4 upload fields on a page. But the problem is that it only outputs the first one and not the rest. All works fine when uploading the files with Drupal's form api, but I just can't ...
0
votes
0answers
21 views

TABLESELECT how to add two textfields in one cell? [duplicate]

How to add two textfields in one cell of table ? function fields_menu() { $items["fields"] = array( 'title' => 'test fields', 'page callback' => 'drupal_get_form', ...
2
votes
2answers
89 views

Entity creation-form: Prepopulate all existing entity-references of a field collection

I have a content-type seasonal_prices with field-collection containing an entity reference field (referencing content-type room) and a number field; the field-collection is multi-value with unlimited ...
0
votes
2answers
48 views

Re-use a form array multiple times

I'm a little stuck here. I want to make a block with 4 upload fields. So i'm trying to set the keys in 1 form array with the name file_link. When editing the block, I can see the 4 upload fields. But ...
0
votes
0answers
14 views

file_validate_size doesn't seem to work

I'm currently learning how to make a custom module that creates a block with a textfield and upload field. So far so good, only thing is: Drupal doesn't seem to respect my file_validate_size value. ...
0
votes
1answer
25 views

Add block to form (before submit button)

I'm having problems placing a block in my form. This is what I have now: I have a register form and a fb button block. I say the block must be visible only when page is equal to user register page. ...
0
votes
0answers
19 views

Can I apply more than one ajax callback to a field?

I have the following code in hook_form_alter() $form['field_sector']['und']['#ajax'] = array( 'event' => 'change', 'wrapper' => 'sub-sector-wrapper', 'callback' => ...
0
votes
2answers
67 views

Form submit handler not working

I'm developing a pretty basic module catalog_request that creates a form. I'm replacing the form's default submit button <input ..type="submit" /> with a <button ...>click</button> ...
1
vote
3answers
97 views

Disable ordering in entity reference (user)

I have an entity reference of widget type = autocomplete. It's a collection of users where you can add multiple users. Now I would like to disable the ordering of the users. So you can't order the ...
0
votes
0answers
14 views

Multiple Field , same ajax callback

I created a custom field. The hook_field_widget_form has an submit element with an ajax callback: //Add more $element['add_zone'] = array( '#type' => 'submit', '#name' => ...
0
votes
1answer
35 views

How to get attributes of the form elements?

I know that it should be easy, but currently it doesnt work. In my function I want to get #title of each element in the form. My form is fieldset "add_company". For example, when I try to get #title: ...
0
votes
3answers
58 views

Form: Custom submit callback is not called

I have a form with a second button which should add new form elements according to this page. The callback does not get called though. The second button is configured as follows: $form[ 'addTicket' ] ...
0
votes
1answer
47 views

Form elements update and deletion in D7

I have made a form in D7 using form API,submitted values to that and retrieved entries from database;now what i want is to add a delete link in front of every retrieved row.My retrieval code is: ...
0
votes
1answer
22 views

My ajax Drupal form shows up old values

I have developed and AJAX Drupal add form (textfield and button) using #ajax key and callback function, where I do my process and return my form new element. So when I starts adding my data form, it ...
1
vote
2answers
27 views

add variable to process_page($vars) in form function

Is there an option to change $vars array in form function? I would like to pass some variables to page template in form creation function .. If not, what are other options to influence page.tpl from ...
2
votes
1answer
22 views

Modify how Drupal builds fields on a per form basis

I want to change the way Drupal builds specific fields on a specific node edit/add form on my site. For example, when I use print drupal_render($form['textarea']); in my ...
0
votes
2answers
33 views

AJAX error when ctools_modal_command_dismiss() is called

So I'm having a problem with dismissing a Ctools modal within a form submit's callback function. Once I have processed any submit data, I'd like to dismiss the modal without redirecting the page (easy ...
1
vote
1answer
192 views

User with uid=0 in database

I had to build a form with a select field populated with all the users registered in database. There are 10 users that I can see in admin>people. To get all the users, I used entity_load('user'). ...
1
vote
2answers
45 views

Submit handler doesn't work after theming the form

I have a form: function payment_system_coeff_form($form, &$form_state) { list($_SESSION['payment_systems'], $_SESSION['coefficients']) = payment_system_table(); $form['submit'] = array( ...
0
votes
1answer
39 views

Ajax field default value on edit form

I want ajax dependent fields in one of my node's form so I am altering the form. here is the code function mymodule_form_alter(&$form, &$form_state, $form_id) { $selected_first = ...
0
votes
0answers
25 views

Rebuild exterior elements of form on submit

On the user page I display two types of groups a user can be subscribed to: a pending membership or an approved membership. To illustrate this: The 'cancel membership request' button is the submit ...
1
vote
1answer
115 views

How to prevent drupal form's managed file upload ajax field from resetting the $form_state?

Edit: working code, although pretty ugly: if ( isset($form['submitted']['stelle']['#default_value']) && $form['submitted']['stelle']['#default_value'] !== '' ...