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
3answers
13 views

User Registration Disable Email Verification

I have unset the value of email address on the user registration form. However, after selecting save, the error shows that its still requesting the email. here's the code: function ...
1
vote
0answers
14 views

Replace node add/edit form with a custom form

I have this custom form I made in my module which is responsible for adding/editing a specific node type. I was not able to alter the built-in add/edit form to meet my requirements so I decided to ...
0
votes
0answers
12 views

Custom menu with drupal_get_form plus form_alter_hook

I'm working in Drupal 6 to create a custom module. I have a menu that creates some custom URLs and tabs for me, and each item runs a page callback function, which itself runs drupal_get_form. What ...
0
votes
0answers
14 views

Drupal 7 node save gives intermittent token validation error

When submitting a content type node I'm occasionally seeing a form validation error regarding tokens being invalid. I've tried reducing the token tree depth too using Token Tweaks which helps on ...
0
votes
2answers
34 views

How can we retain dropdown list value, when we select the option?

I want to retain dropdown list value, so that when ever someone select the option from the dropdown list should retain that value after performing the action. /* *implements hook_menu(). */ ...
1
vote
1answer
13 views

Ajax in a form produces an error

suppose this form: function test_ajax_form($form, &$form_state){ $form['school'] = array( '#type' => 'textfield', '#title' => t('School'), ...
0
votes
0answers
6 views

Checklist API check or unchecked?

I'm working on a Checklist using the Checklist Api Module. This module is very straight forward to created checklist. However, I want to be able to have control if the is uncheck or not. I would ...
0
votes
1answer
23 views

How to query the database to create a report based on user input variables in a form?

I am creating an example report of user data based on selection criteria selected in a form. I can create the form variables, and I can redirect the user to the report output page, but how do I ...
0
votes
1answer
24 views

Add field collection table in code

I am creating a form to collect data for a specific content type which has a field collection in it. So basically I am creating nodes manually through form API. What I need to do is to add a field ...
0
votes
0answers
20 views

How to show report output below a submitted form?

I'm creating a form with a submit button. Below the submit button after the user submits some input data, I want to display the results of a report that I create by querying the database using the ...
0
votes
1answer
16 views

Send form contents to the admin's email

I have created the form using custom module, and it is working fine now. In this case, when I submit the form it simply sends the mail to the particular person from particular id. For this what i did ...
0
votes
1answer
10 views

Mimic webform date field in custom form

In one instance we are using a webform to create a form and it uses field type 'date'. The end result looks like this: I would like to mimic this, but in a custom form. Currently what I have is: ...
0
votes
0answers
12 views

managed_file upload clearing $form_state

I am having an annoying problem whereby $form_state['values']['region'] and $form_state['values']['country'] are being cleared when I upload an image via the managed_file field. This is causing a ...
0
votes
1answer
42 views

How to populate the select option using select index

-- Modifying my previous question -- This really got me. This is what I am doing right now with my module. I created a menu_hook which creates a form using a theme to create data. Another menu link ...
0
votes
0answers
22 views

Saving form fields on custom entity

I'm having problems saving my custom entity to the db. I created a custom entity called 'review' using hook_entity_info() with a custom controller. I have specified some parameters in the controller ...
0
votes
1answer
20 views

Set default value for Enity Reference using View and Entity Reference View Widget Checkbox

Basically i have a field (in line item(commerce custom product)) with Field type: Entity Reference and Widget:View. The view is a list of terms and has an aditional field type:Entity Reference View ...
0
votes
0answers
16 views

Drupal menu calling variables in the template

When I use these functions it gives me a permanent redirect error on the code whereas when I use other page callback it does not give me any problems. function kbc_menu() { $items['hello3'] ...
0
votes
1answer
28 views

Enable/disable a menu item programatically depending on a variable value

I need to show a menu item only in certain moments. Imagine that I've a form with some options. If 'A' is selected, I need to enable a menu item that has a form for adding information about 'A'. I ...
4
votes
2answers
77 views

How to get Form API #states selected value onchange?

When I'm using #states to set the visibility of a form field I'm checking an input element for its value. Is there then any way to grab the selected value the moment it's selected? In the working ...
0
votes
1answer
15 views

Form submission confirmation popup ( a variant of )

I have a lengthy node form. When the user clicks 'Save' I want them to be asked a further question which causes a flag field to be set or unset. For instance upon node form submission the user is ...
1
vote
4answers
57 views

Redirect anonymous users to custom URL

I would like to implement a custom redirect for anonymous users that try to access a form built with FAPI. user_is_logged_in is used in access callback to provide true or false. However, I couldn't ...
0
votes
1answer
18 views

Panels - build own dynamic layout

Does anyone has any idea how to create own custom dynamic layout for Panels3? What I mean by dynamic is that I want to create 1x2 grid and have an ability to add new rows with "Add new row" button. I ...
0
votes
0answers
15 views

Field Group Ajaxified Horizontal Tabs

There is a module that allows ajax-load of multipage fieldgroups: https://www.drupal.org/project/field_group_ajaxified_multipage I need the same functionality for horizontal tabs fieldgroups, instead ...
1
vote
1answer
35 views

Drupal 7 change default user login functionality

I want to change the default login functionality to look at a web service and if true log in else do not log in. I have tried to use in hook_form_alter $form['#submit'] = ...
0
votes
0answers
26 views

How to customize survey builder form by programatically in drupal

I have installed survey builder module. Using this we created survey pages, but form elements are not aligned properly. I want to give some style to survey form elements. How can i make it is ...
0
votes
0answers
20 views

How to programmatically save a form with it's default values/state

What is the easiest way to get $form_state and all it's default values? It only needs to contain the default settings that are loaded from the variables I already set. I'm trying to manage theme ...
0
votes
2answers
42 views

drupal store and retrieve variable from $_POST array

This is really simple question for the user who are using DRUPAL for many years.But for me it is creating a big issue. I already made a form using the drupal form api.But after submit the form I want ...
1
vote
1answer
31 views

How to add an autocomplete field to a form

I've got a page that, in response to a button click, brings up a Bootstrap modal form. In that form is a textfield with the standard Drupal autocomplete behavior; it's working fine. I now want to ...
0
votes
0answers
22 views

Drupal 7 How to change a node form's checkboxes during node_validate

I have a node form that contains a checkboxes field with options NULL at the time the form is displayed. During node_validate, if certain criteria is met, an array of options (checkboxes) is created, ...
0
votes
1answer
26 views

Drupal 7 Checking for an empty entity reference field in hook_node_validate

In checking whether a form field contains an entry, it has been typical to do something like: if (sizeof($form_state['values']['my_field'][LANGUAGE_NONE]) > 0) because an empty field would still ...
0
votes
1answer
56 views

How to do autocomplete in a Bootstrap modal form?

I've got a D7 page that constructs a Twitter Bootstrap modal form; it appears in response to a click on a button on the page. I'd like to have in that form a textfield that uses the standard Drupal ...
0
votes
0answers
19 views

Webcam Plugin Doesn't Work in my Drupal 7 Forms API

I've been developing a module that must have a capability to capture a user's profile picture. This is what my interface looks like: Where in fact it should be like this: (sample.php) Webcam ...
0
votes
5answers
50 views

How do you render a set of checkboxes without using drupal_get_form()?

I want to use a '#type' => 'checkboxes' render array to display some checkboxes on the page. They aren't going to be part of a form that ever gets submitted, as they are purely for browser-side user ...
0
votes
1answer
16 views

Drupal forms, how to output content of a date (array)

I have a form made with the Drupal Form API, there is a date field which result I want to output to the user in an email. I'm only getting array as output, so how do I access the keys and values? ...
1
vote
3answers
23 views

Multiselect values not getting saved in hook_settings()?

This is the code I have implemented in my module which is working fine! /* * This is a helper() */ function MYMODULE_feeds($page_id = '') { foreach($pagefeed['data'] as $feedval) { ...
0
votes
1answer
29 views

Removing field wrapper in a form

I would like to theme a form, and the div wrapping my text input element prevents me from doing what i want. So i got this right now : <div class="form-item form-type-textfield ...
0
votes
1answer
41 views

How to alter cck field title using hook_form_alter?

I want to change #weight, #prefix, #title for a cck field. First I tried the following code. function test_form_taxonomy_form_term_alter(&$form, &$form_state, $form_id) { //Working ...
0
votes
0answers
23 views

Open a Browse Dialog for Image Upload when a context menu is clicked in Drupal 7 Forms API

I've been developing a module that must have a capability to browse and upload a user's profile picture. Before I was using a managed file form control to browse and upload a picture but as time goes ...
2
votes
4answers
63 views

myform_validate() and myform_submit() functions not responding

I have built a form from following examples on tutorials but neither the accompanying _validate() nor _submit() functions are responding when I submit this form. This is my codes: /** *implementing ...
1
vote
1answer
17 views

Adding a button to a form that links to an external URL

I am trying to add another button to a user login form. I am able to get the button to show up, but not to link to an external URL (example.org in the code below). Code I am using is below: ...
0
votes
1answer
12 views

Textfields are not populated with user inputs after validation fails

Im facing the same problem than this guy : 6 - Form fields getting cleared off of user inputs after validation errors The difference here is that I'm not using ubercart. Also my textfields use ...
0
votes
0answers
25 views

How use geofield_openlayers in custom module

I'm writing a drupal custom module, in my form I need a geofield with openlayers map widget. I can create a geofield_openlayer by using Content type, but I don't know how can I create the field in my ...
0
votes
0answers
13 views

How is a form rebuild if it fails validation?

I wondering how it is rebuild if validation fails. Say you have several inputs. Change them all and submit. A certain rule isnt validated so the form validation fails (with a form_set_error). What ...
0
votes
1answer
22 views

Identify form control id in Drupal 7 Forms API

does form controls in Forms API have id's? Below is my sample code: function myid_user_page_form(){ $form = array(); $form['id'] = array( '#type' => 'fieldset', '#title' ...
0
votes
1answer
36 views

Dont Refresh Drupal's Page after a button is click in Forms API

I had started developing a module in Drupal. I made two form controls: a fieldset and a button. The button calls a javascript function "myphoto_options" when it is click. This function only does an ...
-1
votes
1answer
54 views

Form state values problem

I dont understand the problem im facing. I'm building a big form (in which you can add products, modify quantity, etc etc and validate. I'm getting consistency data problem between what's in ...
0
votes
1answer
27 views

Override submit function in Drupal 8

How can I override the submit function in Drupal 8? (alter the submit function) I tried adding this to my hook_form_alter: $form['#submit'][] = 'mymodule_form_submit'; but it doesn't goes into the ...
0
votes
1answer
16 views

I can't remove an manage_file field image

I have the next managed_file field: $form['portada_field']['imagen_portada'] = array( '#title' => t('Imagen'), '#type' => 'managed_file', '#description' ...
0
votes
1answer
13 views

Add a Canvas Form Control in Drupal Custom Module

Im currently developing a module and I have this code in html: <canvas id="cnv" name="cnv" width="500" height="100"></canvas> I want it to add in my page using form controls but when I ...
0
votes
0answers
22 views

Having trouble selecting elements in jQuery with JS added on the form

I have a form with a file element and a button. When I click the button it is supposed to run some JS. I have tried three separate ways to get this to work but each way gives me a different result. ...