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

Insert class in AJAX change Ubercart

I am trying to add a class onto an element after switching it out using AJAX. It's a select form, and whenever I switch countries, the state/zone field switches. Otherwise it isn't a problem, except ...
0
votes
1answer
21 views

Load Javascript when a particular form is loaded

I have the code below in my own drupal module(myid): myid.module file: function myid_init() { drupal_add_js(drupal_get_path("module", "myid") . "/js/myid.js"); } function myid_menu() { ...
0
votes
2answers
36 views

getting form title

I have a form created by using custom module, I can get all the fields but now how should I get the form title? below is the code to get the specific field in .module file. $form['name'] = array( ...
0
votes
0answers
18 views

Question about adding a field value to a view programmatically

I am having a problem getting a field to print and know it is something I am missing. I am trying to print a product field in a view that is created programmatically. Everything else is working fine, ...
0
votes
0answers
10 views

Ctools content type with ajax enabled form

I am trying to accomplish the following: I have a ctools content type that renders a table (theme_table). The contents of the content type plugin consist of a variety of database records about ...
0
votes
2answers
13 views

How can I hide one commerce specific shipping option without deleting?

I am trying to hide a couple of Commerce shipping options we no longer use. I can't figure out the proper syntax for addressing the individual form radio options. Here is what I have so far: ...
2
votes
0answers
52 views

Invalid form POST data - ajax for Authenticated users

I have a Drupal form using ajax. When I submit the form I am getting the following being displayed: When I check the Drupal log I have the following entry. I have Googled the error and found ...
0
votes
0answers
17 views

Get markup element value in drupal 7

I have canvas element in my form. I want to save canvas.toDataURL into a drupal variable (myid_registrar_signature) after the submit button is click. How will I do that in Drupal 7? function ...
0
votes
1answer
20 views

Form is still trying to do validation

I have heavily modified an Ubercart form. I have tried to remove the initial validation placed on this because I'm using a whole host of different fields. For some reason, however, the validation is ...
0
votes
0answers
11 views

How to process form in template when you aren't printing the entire form

I have a form where I am only printing out certain parts of it because I want to style around them. i.e. <?php print drupal_render($variables['form']['field_city']); ?> However, when I try ...
0
votes
1answer
24 views

OnClick Event not Captured

I was currently developing a module(myid) in Drupal. I made a button(#myid_registrar_button) that must alert whenever it is clicked. Below is my code: myid.module file: <?php function ...
0
votes
1answer
45 views

How to set the first option as the selected in the SELECT form via hook_form_alter

I have created a Views with an exposed filter and I tried to use hook_form_alter to convert it to a select list. Now, I need to set the default value as the first option whatever output in the select ...
0
votes
0answers
13 views

Can't create two separate row divs in a form

I am trying to have each case be in a specific row. The first row works correctly, however the second row absolutely does not. The field_suffix in the form is far to the left whereas I want it to the ...
0
votes
3answers
21 views

Upload and Save an Image in the Server

Im currently developing a module that must have a capability to browse/select and upload an image to the server. function myid_user_page_form(){ $form = array(); $form['id']['myphoto'] = ...
0
votes
5answers
55 views

Custom Form module

I want to create my custom module for making contact form using FAPI. I created 2 files one is .info and other is .module. But I can not understand how should I link that module with my template name ...
0
votes
0answers
10 views

drupal_get_form in hook_form for a custom node type causes error

I added a custom node type using hook_node_infom call it /** * Implements hook_node_info(). */ function example_node_info() { return array( 'example' => array( 'name' => ...
1
vote
1answer
15 views

Ternary operator not evaluating checkbox values

I am using Drupal 7. I have created a form using the Form API, in which I defined several checkboxes. The form sends its contents in an email and this works fine at the moment as long as I simply ...
0
votes
0answers
5 views

How to add additional Ajax functionality to unlimited field collection items?

I have a field collection (cardinality = unlimited) that holds another field collection (cardinality = 3) that holds a select list with three options (required). For better understanding I left ...
0
votes
0answers
10 views

Display query results in my Form Control

I want to display query results in my Form Control. Below is my code: 1. function myid_user_page_form(){ 2. $enrollment = array( 3. 'database' => 'enrollment', 4. ...
0
votes
0answers
11 views

load mutifield value on button click by passing form field values with ajax

I needed to load field value from an existing node. This has to be done via clicking of button like "load defaults". I know this could be done without button using hook_form_alter while form is ...
0
votes
0answers
27 views

Why is the field default value set during ajax request not appearing in the form

I have the following in my form function if ($_SERVER['REQUEST_URI'] == '/system/ajax' && $form_state['values']['x']) { $r = get_info($form_state['values']['x']); } $form['type'] = ...
0
votes
1answer
21 views

Join a select form with the number of the database to check

I have this select form: $options = array( '20' => '20', '100' => '100', '500' => '500', '1000' => '1000', '5000' => '5000', '10000' => ...
1
vote
1answer
20 views

Create a module to access a 3rd party API and store the keys in the database

I am new to Drupal module development, and have searched but haven't found any tutorials or guides on how to create a module to do the following: Access a 3rd party API via a form Store the user ...
0
votes
1answer
32 views

How to specify in a form field's #ajax setting that the entire form should be rebuilt

I have a form with 3 sequential selects at the top, each populated as a result of the selection in the one prior. After the third select is choice is made, a large number of fields segregated into ...
0
votes
0answers
13 views

Custom HTML output of site wide contact form

I'll display site wide contact form in block, probably using some additional module because I didn't find any solution for that. Now, I need to have exact HTML output of entire form, here is the HTML ...
0
votes
0answers
23 views

drupal default image field without “remove_button” on edit form drupal 7

I have created one event content type. On which I Have field_event_picture image field. Now what I want is, when user edit event form user will click on field_event_picture and browse popup comes up, ...
1
vote
0answers
25 views

Custom module data storage

In Drupal 6, I'm writing a custom module that generates several pages (as a Drupal newbie). Mainly public form pages for soliciting donations - users fill out their info (amount, frequency, etc.) and ...
0
votes
1answer
12 views

How do I add a payment view block to Commerce Order page?

At example.com/user/123/orders/993 the customer sees an Order #993 page to review the history of a particular order. I already have a View with a block display of the payment information for a given ...
0
votes
1answer
22 views

How to use drupal_add_tabledrag() with paging feature?

I have set up a table to reorganize content based on custom weight field. Everything works well without pager. But if I add a pager to the form, only the items displayed will be reorganized - causing ...
0
votes
1answer
26 views

CKEditor not displaying in latest 8.0.x-dev version

After updating Drupal from version 8.0.0-beta7 to version 8.0.x-dev — to fix text_format fields not submitting their value due to a missing name attribute —, my field is now displaying as a basic ...
0
votes
0answers
41 views

Change select list argument and rebuild on form state change

So, I'm trying to filter a select list by one of the other fields on a node. In this case, we will select a taxonomy term (you can only choose one) and then based on that rerender the select list of ...
0
votes
2answers
17 views

User email being deleted when submitting Profile 2 form

i'm debugging a site that I haven't made. The issue is that the users email address is being deleted. I've found which form it's happening on; and by using hook_form_FORM_ID_alter I can see that ...
1
vote
3answers
29 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 ...
3
votes
1answer
68 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
20 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
23 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
54 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
15 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
9 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
48 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
27 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
25 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
25 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
17 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
14 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
2answers
59 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
43 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
29 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
33 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 ...