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

learn more… | top users | synonyms (1)

0
votes
0answers
4 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
14 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 ...
0
votes
1answer
21 views

field formatter settings won't save [on hold]

For my custom field, i have a field formatter with multiple settings. It's like the default number field formatter (decimal separator, thousand separetor and scale) but with two additional options. ...
1
vote
1answer
26 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
26 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
28 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' => ...
-5
votes
0answers
37 views

How to open form on radio button click in Drupal [closed]

How to load Drupal form on radio button click? I have 3 registration forms in my site, I have to created 3 radio buttons. On radio button click, I want to show a form, see the image below.
0
votes
0answers
16 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
15 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
17 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
25 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
21 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
20 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
83 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
46 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
13 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
18 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
56 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
95 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
10 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
34 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
47 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' ] ...
-3
votes
1answer
29 views

Add content form in a block

I want to add content form in a customized manner. For example consider Twitter is a custom content type i want a create a add new tweet button and display only the body field hiding the title and ...
0
votes
1answer
46 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
20 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
24 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
18 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
21 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
181 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
43 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
32 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
24 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
70 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'] !== '' ...
0
votes
0answers
26 views

html form and navigation

I am trying to figure out a way to add a html form that would allow me to call a external php program, I have issues with navigation, some how after clicking the submit button I am redirected to the ...
0
votes
0answers
22 views

Custom form adding a commerce price field

I am creating a custom form using the form api. I want to add a Price field from Drupal commerce to my form. Is it possible to add the Drupal commerce price field to a custom form. Updated Made it ...
0
votes
0answers
12 views

Program a pre-set value for a form block?

I have a simple custom module that creates a form block. We use this block to post content into a panel without the use of the PHP module. We wanted to know if it was possible for us to set a ...
1
vote
1answer
30 views

How to add class to individual radio item inside “radios”?

I need to style my radios as tabs. So I created a form element like this: $form['important_categories'] = array ( '#type' => 'radios', '#label' => NULL, '#attributes' => array ( ...
0
votes
0answers
13 views

Get the form elements dynamically for addressfield

I need to build address fields for a client, depending on the country. I wanted to use addressfield, since it has all the code to generate these forms for node edits. The code I'm using is: // get ...
1
vote
1answer
177 views

How to attach Dropzone.js uploads to a form element

I'm integrating dropzone.js into my form, but I have an issue regarding my file uploads. I have my dropzone set up, and file uploads are in the $_FILES array. I want to call file_save_upload to ...
0
votes
0answers
26 views

Saving body as HTML in custom content types

I have a custom content type that I want to save data to, the content type has custom fields and I used a secondary form that supplies the from data to be stored, when the user sees the view, the ...
0
votes
2answers
42 views

Attach js file to every page w/term reference widget in Drupal 8

I have begun trying to port a small, simple module that I maintain to Drupal 8. It was originally written (not by me) in Drupal 6 and used hook_init() in combination with drupal_add_js() to attach ...
0
votes
1answer
24 views

Setting #element_validate in a form (not form alter) removes original #element validation

I have an element with set #element_validate (in hook_element_info) and I use this element in a custom form. The problem is that when I try to add an additional #element_validate to the element in the ...
0
votes
1answer
14 views

user_profile_form doesn't show profile2 information

I'm trying to modify the user_profile_form, but it isn't working. My regular user edit information shows up, but not my profile2 information. function MY_MODULE_form_alter(&$form, ...
0
votes
0answers
31 views

Redirect to exernal url with posted data

I am using third party service (payment) which requires users to redirect to their payment page with posted ($_POST) data (this can be done by setting form action, very simple), but problem is - their ...
0
votes
1answer
30 views

Webform validation are working but they some error

when i am login or page redirect to home page they can show this notice " Notice: Undefined index: submitted in web_alter_form_validate() at line 19" here is my code function ...
1
vote
1answer
25 views

Issues with the entity field output

Suppose, we have an entity "song", that has a required field, called "authors": In the list of songs in the admin panel I want to output the list of all the authors in the search block: //search ...
1
vote
1answer
59 views

How to disable i18n language dropdown in node form?

I'ld like to prevent editors from changing the language of a node. Role check works. But I how to disable the language field? Why doesn't it work like any other form field? How is this field placed ...
0
votes
1answer
34 views

Add autoupload property after page load using plupload

In a form I have added a field for images, set the file source to "Advanced upload widget (Plupload)" ( all other checkboxes are unchecked ) and I get the interface. I want to make it autoupload ...