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

learn more… | top users | synonyms

1
vote
1answer
17 views

radios options separated into different wrappers

I'm trying to customize a radios field to wrap some of the options into a div. What the best way to do it? I had a look to theme_radio but no success on it :( example: <div id="part1"> ...
1
vote
1answer
11 views

Textfield Ajax Callback Function Conflict

I have 4 elements in my form: 2 text field and two search buttons. Below is an image: Code: function myid_print_user_page_form($form, $form_state) { $form = array(); ...
2
votes
1answer
28 views

Display term description below a field widget based on the selected option on node edit form

I am trying to show a block (or the term description) on the node edit form when a user selects the term. An example: User is creating a node with a "location" vocabulary. They select their state ...
0
votes
1answer
10 views

External authentication module prevent further authentication

I am trying to make an external authentication module for Drupal, and I have one almost done, except that after I successfully authenticate the user (or throw an error), Drupal's standard ...
0
votes
0answers
31 views

How to get value form when submiting the form in drupal 7

I'm writing a module and face a problem as follows: I created two forms in a module. The first form with two submit buttons and each button submit a redirect to a different page. I want when I hit ...
0
votes
0answers
10 views

Detect if user presses the “Enter” Key in a Textfield using Drupal Forms API

I have a simple form with a textfield and a div element: function main_form() { $form = array(); $form['textfield'] = array( '#type' => 'textfield', ...
1
vote
1answer
10 views

Using placeholders in watchdog function

I know this is simple. I have a callback function callback below: function callback($id = '121-01927'){ watchdog('print', '%message : Sample',array('%message' => $id), WATCHDOG_DEBUG, $link = ...
0
votes
1answer
39 views

Form validation not triggered at first submit, but on second submit

I'm in the need for a extra validation on an existing drupal commerce form (commerce_cart_add_to_cart_form_##), strangely the validation function is not called on the first form submit, but on the 2nd ...
0
votes
0answers
16 views

How to pass an argument in a callback function generated by an ajaxified link?

I have an ajax link in my form element: $form['print']= array( '#type' => 'item', '#markup' => l(t($record_uid), 'admin/callback', array('attributes' => array('class' ...
1
vote
2answers
12 views

Access Denied when Menu CallBack Function is Called

I am trying to call a function after the user clicks on an ajaxified link below. $form['link'] = array( '#type' => 'item', '#markup' => ...
0
votes
2answers
21 views

Add placeholder or default value to captcha text field

There is a webform in my website, I added the captcha to this webform using this code: function THEME_form_alter(&$form, $form_state, $form_id) { if (strstr($form_id, 'webform_client_form')) ...
1
vote
0answers
11 views

Drupal form #ajax callback and javascript toggleClass on radio buttons - reduced functionality

we're using drupal and I have setup an ajax callback on a form item. The form item is a radio button with two options on/off. also attached to the radio button is some js to toggle a class. The class ...
1
vote
0answers
18 views

D7 forms: select values from a select list when a checkbox is checked using ajax

In a node form I have 2 fields, the first one consisting in a list of regions, the second one consisting in a list of countries. The needed behaviour is that when I click (let's say) "Africa" from ...
0
votes
1answer
26 views

Is it possible to trigger an Ajax CallBack Function After a Link is Click

I have a simple link in my form. $form['myid_print']['myid_print_search_idnumber_wrapper'] = array( '#type' => 'item', '#markup' => '<a>Im a link....</a>', ...
1
vote
0answers
7 views

How can I return data from ctools modal to parent form

Let's say I have a Drupal form with a "Open popup" button and a text field. If user clicks on the button, I'd like to open ctools modal popup with two buttons (#3 and #4). Clicking on any button in ...
1
vote
1answer
16 views

Can we return 2 table themed arrays in function

I have 2 arrays, but the 2 have different key values you can see in foreach for one it is src, where as for another it is source. I would like to show the both both tables on one hook. But this seems ...
0
votes
1answer
33 views

Display Special Characters in Drupal Forms API

I have a variable fetch from database which contains special character ñ. For Example: $student = 'Evangeline O. MontañO'; $student = 'Rosalyn G. QuiñO'; Displaying it in my form causes ajax error, ...
1
vote
0answers
19 views

Remove extraneous Symbols/Characters in a variable

I have a variable $student whose value is from the database. When I tried displaying it in a table using Ajax callback function, it throws an error saying: But when I initialized the variable ...
0
votes
1answer
15 views

Ajax HTTP Error Occured in Theming Tables

I have two elements in my form: a select element and a div with an id of #myid_table_wrapper. function myid_print_user_page_form() { $form = array(); $form['options'] = array( ...
1
vote
0answers
28 views

Drupal 7 form api > Display part of tree outside tree

Very hard to explain by title, but this is what I mean: I have a form which shows packages and their add-ons. A simplified version: foreach ($packages as $package) { $form['package_' . ...
1
vote
1answer
21 views

Get id of selected option in Drupal Forms API

I have a select element in my form. function myid_print_user_page_form($form, &$form_state) { $form = array(); $form['options'] = array( '#type' => 'select', ...
1
vote
1answer
29 views

Update theme table using callback function in Ajax

I have two elements in my form: a select and a table element. Everytime onchange event is triggered on select element, I want to update the values in my table. I want to do query and change the values ...
1
vote
0answers
10 views

Webform Custom-Field Module and validation

I am currently working on a Webform that is used to enter some rather complex finance information (think tables with sums and other weird checks). Since the styling has to be rather specific for this ...
1
vote
0answers
11 views

Drupal.ajax.keypressResponse Error

I've been using the code below, that can be found in the link: (function ($) { Drupal.ajax.prototype.keypressResponse = function (element, event) { var ajax = this; ...
1
vote
1answer
13 views

How to hide a form element having a certain class in ajax callback in form?

How can I hide the product using ajax callback . I am trying to implement that using ajax_commands_invoke but it does not work using below code $form['field_product_type_select']['und']['#ajax']= ...
0
votes
1answer
21 views

How can I dynamically disable a single required field from validation in a form?

This is an extension of this question: Need help with AJAX callback function for text field validation in form_alter I have a form with a Username autocomplete field (txn_user). The editors want to ...
0
votes
1answer
38 views

Callback Function not called using Ajax

Below is my code: function id_print_user_page_form() { $form = array(); $form['idnumber'] = array( '#type' => 'textfield', '#ajax' => array( ...
0
votes
1answer
13 views

Getting form Array from a webform created with Webform module?

Is it possible to easily get the form Array from a webform created with Webform module? I want to be able to call a copy of the form elsewhere thanks
1
vote
1answer
17 views

tableselect does not work for me somehow 1

Array ( [table] => Array ( [#type] => tableselect [#header] => Array ( [field_name] => FIELD NAME ...
0
votes
3answers
47 views

Custom module for form

I have created form by implementing custom module. Can anybody please guide about writing submit function for my form. function custom_form_module_form($form,&$form_state) { $form['name'] = ...
0
votes
2answers
33 views

how to get previous step values in next step in drupal multi step form?

How to get previous step values in drupal in the next step in a multiform. I want to display the values other than drupal_set_message(). I want to use these previous values in other function in the ...
0
votes
1answer
36 views

Can I make Text Field accept filtered_html?

I have a content type where a field is the common name for a USA president. In examing a legacy database I'm importing some presidents have (simple) HTML in their name. For example Dwight Eisenhower ...
0
votes
1answer
22 views

Custom form handler not found in Drupal 8 (call_user_func_array error)

Currently on Drupal 8 beta 7. I'm trying to build a form with separate "submit" and "cancel" buttons. The cancel button has some separate cleanup work to do. I've tried to follow the documentation ...
0
votes
1answer
17 views

Load and submit user profile form

I want to programmatically load the user profile form for a specific user and submit it ( in order to trigger hook_form_submit() in another module ). So far I have : module_load_include('inc', ...
0
votes
2answers
13 views

Change the title of date_popup filed in custom form

I'm building a custom form in Drupal 7 and i need to use the date_popup widget in it. It all works as expected, except the title of the field. My code is: $form['filter']['start_date'] = array( ...
0
votes
0answers
13 views

Save fieldset state in form

I've build a custom module and a custom form with form API. I also allow users to come back and edit so I re-populate their old values. The issue I have is that some of the form is in a collapsible ...
0
votes
0answers
46 views

Save details of form to database table in drupal 7 [on hold]

I'm new to Drupal. I'm fetching ids and title from a database table as key-value pairs and adding them to a drop-down select list. After selecting the respective items in both the lists, I want to ...
0
votes
0answers
9 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
36 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
38 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
1answer
23 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
14 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
14 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
1answer
117 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 ...
1
vote
0answers
20 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 ...
1
vote
1answer
22 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
14 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
33 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
50 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
16 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 ...