Forms are the primary method for obtaining and acting upon user input in Drupal.

learn more… | top users | synonyms (1)

0
votes
1answer
16 views

How to reset/save $_SESSION variables in forms for each user?

I need to add captcha to user login form after 3 failed logins. To do so I built the following module, and used $_SESSION['failed_login'] to keep track of the number of the failed logins. This ...
0
votes
1answer
8 views

Comment Forms - place label inside the inputs

I'm theming a comments section on a page in a D7 site. What I want is for the label for the forms items to show as a placeholder attribute rather than above the element. I've used a hook_form_alter ...
1
vote
1answer
16 views

Implementing a search and results page in the admin interface

I'm trying to implement a search and results form in the admin interface but I am having trouble getting the search function and pager working. [1] The pager is not showing at all. I've got this ...
0
votes
1answer
16 views

how to add multiple style values in attribute in drupal form

I have form element like as follows : $form['precio'] = array( '#type' => 'textfield', '#title' => t('Price'), '#default_value' => $precio, '#size' => 20, '#attributes' => ...
0
votes
0answers
28 views

Ajax on custom route

Any Help would be appreciated : I've created a custom page via hook_menu in drupal 7 in which there is a custom form implemented (and additionnal features). I'm trying to implement an Ajax callback ...
0
votes
0answers
11 views

Default value to 'datetime' field in form loaded from the database

I want to display the datetime field on my Drupal 8 form with some date loaded from the database, but the front end always shows empty fields as if no data has been provided. I tried several ...
0
votes
1answer
40 views

How to dynamically create Drupal 7 tables based on form API input values?

I have an array with the data below: arr_fields[0] = 'a bigint' arr_fields[1] = 'b bit' I want to structure it just like the array structure below: $fields = array( 'a' => array( ...
0
votes
0answers
18 views

Combining forms

I want to have a fixed number of custom entity add forms combined in one large form, on the same page. Submitted through one submit action. Inline entity form is not really suitable for me in this ...
1
vote
1answer
14 views

Setting date_popup year range to more than the 3 years default in Drupal 7

I have a custom module and using date_popup. Currently the popup only shows a 3 year range in the date popup. $form['startdate'] = array( '#type' => 'date_popup', '#title' ...
0
votes
1answer
15 views

How do I turn a select list into a radio button?

I have a list text field that I want to display as a series of radio buttons instead of a select (dropdown) list. In Drupal 7, I could change this on Manage fields. How can I do that in Drupal 8?
2
votes
1answer
27 views

How to keep URL parameters on subsequent pages after a form is submitted?

I'm sending a referral form out to my email database and I've got it set up so that their email addresses get passed through and appended to the form URL like this: ...
0
votes
0answers
10 views

How to add basic form fields to field group tab?

Now I have profile2 form presented in tabs. Tabs are field groups. Now I want to add to empty field group some basic form fields (not related to Field API). I tried to use ...
0
votes
1answer
19 views

Building a custom module holding a simple form, submitting to the database [closed]

I'd just started on Drupal and I'm pretty lost after creating my own custom module. So far I've only created a page that shouts 'Hello World'. What I want to do is just create a simple page that holds ...
0
votes
0answers
19 views

Detect Keypress Event in TinyMCE Text Area in Drupal 7 Form API

I already successfully embedded a TinyMCE text editor in a text area in Drupal 7 Form API. See code below: $form['text-modal'] = array( '#type' => 'text_format', '#format' => ...
0
votes
0answers
13 views

Theme a taxonomy term form [closed]

How would you process to theme a taxonomy term form? I can easily create a custom form an render it, but I would prefer to theme using a .tpl.php. I did find a great link: How to a use a template file ...
0
votes
1answer
28 views

Customize admin form field in

I need to customize the aspect of one single field in a editing admin form. More specifically I want change the height of a multiselect field. Have I to create complete admin sub-theme containing just ...
1
vote
1answer
17 views

Manually post to search results page

I have a section in my theme where I'd like to manually include a search input. I do not want to use the search block as I have some additional customizations I'm integrating outside of the scope of ...
0
votes
0answers
17 views

Node form array is too big to display - lack of memory or browser crash [closed]

I'd like to investigate what's inside $form variable, but the array is so big that even the browser can't display it (it crashes every time). I'm pretty sure that there are many unused data in this ...
0
votes
0answers
8 views

Ajax form hidden default value not returning values when ajax runs

I have a custom where I need to render a calendar, but only shows the whole week of the current week. I've added an element for the date where I've set the default value to something like below ...
1
vote
1answer
27 views

Submit button not triggering a form submit

I have a strange phenomenon. The code seams to be correct but the submit button is not triggered. dpm says the callback functions are loaded correctly in the $form value like this: When I pressed ...
1
vote
1answer
30 views

How to programmatically create a add to cart form with quantity input?

I want to programmatically create an add to cart form with quantity input and default as 1. I tried to use the code: $form_id= commerce_cart_add_to_cart_form_id(array($product_id)); $product = ...
0
votes
1answer
11 views

SOAP with custom form select

I'm getting results from a SOAP call, but cannot display the values in a select list on my custom module. This is a part of my code: foreach($sxml2->NewDataSet->DepCity as $item) { ...
0
votes
0answers
23 views

form_set_error not highlighting

This is not high light the error field function add_property_property_form_validate($form,$form_state){ $property_name = ...
0
votes
0answers
21 views

( FAPI) Trouble Manipulating Managed Fields with Nested Field sets that can be added and removed dynaminally

So my problem is this. I am trying to create a configuration form that allows you to control the front end of a page display. On the front page there are these regions, and each regions holds text and ...
0
votes
0answers
10 views

radio buttons in a form [duplicate]

$form['credit_type'] = array( '#type' => 'radios', '#options' => array('Single'=>t('<span class="description">SINGLE LISTING</span>Buy a single credit <span ...
0
votes
0answers
33 views

radio buttons formatting

I want to create something like SINGLE LISTINGBuy a single credit 123 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et ...
1
vote
2answers
93 views

How can I implement AJAX form submission?

My task is to submit contact form via AJAX and then to show "Thank you for submission!" message, loaded in place where the form was. So I need to ajaxify existing contact form. I found some examples ...
0
votes
1answer
23 views

Is there a module/hook for permissions for list values?

Say I have a text list field attached to a node with the following values: Apples Oranges Grapes Kiwi Strawberries Pears Bananas But I want to give some options only to some roles, for example: ...
0
votes
1answer
21 views

TinyMCE textarea not editable

I have integrated tinymce in my form, inside a modal. $form['myid_templates_editor']['text-modal'] = array( '#type' => 'text_format', '#format' => 'full_html', '#prefix' ...
0
votes
0answers
11 views

Query all available data types in a typical postgres server

I want to query all available data types in Postgres. How will I do that in Drupal 7 Form API? My code below only query all the data types used by my tables. $query = ...
0
votes
1answer
19 views

how do I open a custom module form in colorbox popup? [duplicate]

I am creating a form in custom module, and I need to show this form in a view. How do I show this form in a color-box popup? I have created a custom block to render this form, but I don't understand ...
1
vote
1answer
25 views

How to remove dropdown items from a form?

I am trying to remove two select list items from a form using this code: function module_r_form_alter(&$form, &$form_state, $form_id) { if ($form_id == 'forum-node-form') { ...
2
votes
1answer
20 views

Å in form option

I have $form['type'] = array( '#title' => t('Country'), '#type' => 'select', '#name' => 'countrye', '#id' => ...
0
votes
1answer
33 views

Redirect contact form on submit

Using Drupal 8 and trying to get the contact form to redirect to the same page after submitting. By default it seem to redirect to the home page. I have edited my themename.theme file function ...
1
vote
1answer
30 views

Where can I find the link between field answers and the user who submitted it?

Noob here. I can't figure out how entity forms stores which user submitted each answer for it's fields on the database. All I can see is a table for each field, and the columns within being: ...
1
vote
1answer
22 views

hook_form_alter help (almost there!)

There are two parts of a third-party module that I am trying to alter. When the user clicks submit When the user clicks reset This is the function from that module. function ...
0
votes
1answer
15 views

Form problem : calendar pop up overriden by an autocomplete field

Drupal 7. I use a bootstrap theme with some customized css. I have a node/edit form with a date field with calendar popup widget and an entityreference field with autocomplete widget. When I click on ...
0
votes
0answers
13 views

Display a function's return value through AJAX response

I have this jquery ajax request below: jQuery.ajax({ type: 'POST', url: '?q=myid_query_db', data:{ 'db_server': 'postgres', }, }).done(function(o){ ...
3
votes
1answer
23 views

Get all databases name present in Postgres Server in Drupal 7 Form API

I was currently developing a module and I want to display the names of all the databases present in my Postgres server through a query. I want also to query and list the names of schemas, tables, ...
1
vote
0answers
20 views

Theming form with template file

I am trying to follow these tutorials (http://themery.com/dgd7/advanced-theming/forms/with-templates and https://www.drupal.org/node/1419390). And I have created these files: login_form.module ...
0
votes
1answer
37 views

AJAX select returns 'illegal choice detected'

Create a settings form for a module in Drupal 8 - when a user selects a View from a list, the drop down under it should populate with the displays in that view. While the form updates the option list ...
0
votes
0answers
22 views

how to alter form field's label to fit bootstrap inline display

i had a long form "enroll" with many field, need all label display inline. i am not using bootstrap theme, but i added bootstrap css and js file. so now i just need alter field output as same as ...
1
vote
2answers
33 views

Hide the title of a form element?

I'd like to use placeholders instead of labels for a form built with the form API. I can get placeholders working well with the Elements module, but now I want to hide the labels. If I just set ...
1
vote
1answer
66 views

How do I manage form display, non programmatically?

In Drupal 8 you can manage in admin/structure/types/manage/article/form-display the form display for your content type. You don't have to rely anymore on contributed modules or in the implementation ...
0
votes
2answers
27 views

Form API: Autocomplete Field in Chrome and Safari

I'm working on a custom webform component to essentially look up entity properties in an autocomplete field. All works perfectly in Firefox, but I'm just seeing an plain old textfield in Chrome and ...
1
vote
2answers
46 views

Display results of a form

I am trying to find a simple way to display the results of a simple checkbox form on the same page after submit. I know you can use the drupal_set_message, but I want to display the results formatted ...
1
vote
0answers
22 views

How can I conditionally add empty text field values based on a list selection?

I'm beginning to create a pretty advanced registration form that has all sorts of conditional logic in it. For instance, if a registrant chooses the "Diamond" level sponsorship in a list, the price ...
0
votes
0answers
12 views

Passing node comment form to node edit template

I want to show node comment form in the node edit page itself. I am trying to do it through theme hook. function mymodule_theme($existing, $type, $theme, $path) { $theme = array(); ...
1
vote
1answer
33 views

Form markup question [closed]

Can I strip my form of these classes and DIVs as showed in the code below? <form action="/example/unsubscribe" method="post" id="exampleform-unsubscribe" accept-charset="UTF-8"> ...
0
votes
0answers
10 views

Autocomplete fields: Append items to the field, not replace?

I have a form with an autocomplete field that pulls items from a taxonomy. I'm using a Bootstrap theme on the site, but things are otherwise ordinary. The field works, except that when I select a ...