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

learn more… | top users | synonyms (4)

0
votes
0answers
7 views

Custom Block with form does not submit

In D8, I made a custom form. After submitting you redirected to a custom page and get a message there. So far nop. Then I made a custom block that render this form into a block region. Everything ...
0
votes
1answer
13 views

No more error messages shown, once i uploaded a file of invalid size?

The scenario is as follow: when i uploaded a file with invalid extension a proper error shown, everything is fine. nothing bad with invalid extensions. where as: when i uploaded a file of larger size ...
-3
votes
0answers
20 views

How can i get to know that a file is in removing process? [on hold]

I want to disable form submit button when an uploaded file is in removing process. But the problem is that i could not get to know that a file is in removing process. I want to disable submit button ...
1
vote
1answer
22 views

How to render a contact form as rendered entity

I have a question about rendering a contact form as a rendered entity. I have a field in my contenttype where form should be displayed. The field has the type Contact form. In the Manage display ...
1
vote
0answers
16 views

How can I programmatically set a default select option in for loop?

I have a for loop in my code that creates elements in a table using data from the database. Each row has a select element, where the default option should correspond to what's stored in the database: ...
0
votes
0answers
15 views

Webform add a submit user confirmation

i want to add a step between the validation of the form (check if there is errors in the form) and the submition of the form (the moment when the form is saved). I want to show to the user a colorbox ...
1
vote
2answers
24 views

Check if form already failed validation

I added a validation hook to a node creation form. For my project, i need this validation only ONE time: basically i just check if a value already exists in the DB and i notify it to the user. If the ...
1
vote
2answers
31 views

Displaying the submitted values in a table

I created a custom form and after the form is submitted I need to display the submitted data in a table? This seems like a very simple problem. I am able to use dpm() and drupal_set_message() to ...
0
votes
0answers
14 views

Getting exposed filters results [on hold]

Can't seem to find it anywhere in the api but I'm interested in getting the output from an exposed filters form, the actual results, not the filter values, anyone have experience with this ?
1
vote
1answer
23 views

How do I get the fields of form attached with a content type as token?

I do not know is it possible or not. I have a content type for creating tickets. I have a form attached to content type which contains ticket state and ticket assignee fields as drop down. Now I want ...
0
votes
1answer
18 views

How can I add a custom form menu link to the administrative menu programmatically? [duplicate]

How can I add a custom form menu link to the administrative menu programmatically? I am trying to add this form as admin menu link like content, structure and module.
0
votes
0answers
12 views

Custom Drupal 7 module providing an admin interface to perform an action based on checkbox form results

To remove a few ui elements from the subscriptions module, I wrote some jquery which took care of the problem but then I wanted to provide a Drupal admin page to provide checkboxes for achieving the ...
0
votes
0answers
28 views

Ajax form callback not executed

I wrote a quite simple ajax callback to alter a views exposed form block. Ajax is fired but no commands are returned. Each time I change the value of my ajax field, I get two logs in dblog : ...
4
votes
2answers
100 views

What does parent::form($form, $form_state) do?

I'm not able to understand what parent::form($form, $form_state) does in a content entity form. If I comment it out, the entity form still get rendered. class AdvertiserForm extends ContentEntityForm ...
0
votes
0answers
12 views

How do I get the checkbox state for an “if condition”? [on hold]

I would like to get a checkbox's value from my form and make a condition. This is my HTML: <input data-drupal-selector="edit-field-st-holidays-validate-value" ...
0
votes
0answers
13 views

How to create delete Confirmation form in Drupal 8 [on hold]

I have a list of the messages I want to delete one of séléctionner.la deleting messages functioning properly but I want before you delete a message displayed a delete confirmation message. } this ...
0
votes
0answers
12 views

Insert a form into a webform

i've created by the backoffice a webform and now i want to add the user_profile form (and modify it to include only fields i want) into this form. I don't know how to do that, i've tried this but this ...
0
votes
0answers
24 views

Create a custom form in Drupal CMS for editors

I need to create a form for our Drupal Editors. The form must allow them to add records to database. I see next steps to do: I add action in place I want. User clicks on action and modal form ...
0
votes
2answers
27 views

Values disappear in $form_state['values']

I have some tableselect in a form which I can click a button and update from a database. When I update it, I need to be able to access those values in my submit function. But those values aren't ...
0
votes
0answers
10 views

Skip save of field collection attached to entity without removing reference to field collection?

I've got a node form encumbered with many field collections and node save takes forever. I would like to "lock" some of those field collections and forgo saving them on node save. Kind of like ...
0
votes
0answers
11 views

Render Registration Form

I'm trying to get a renderable object for the Registration form. This answer looked promising, but it appears that the registration form is an entity form. I looked into this answer which seems like ...
0
votes
1answer
6 views

How to add the node settings “Exclude node title” to a field group?

Since the module does not provide an entry in the manage form settings, how to move "Exclude node title" to a field group in Drupal 8?
0
votes
1answer
23 views

An illegal choice has been detected. after leaving form page

I have a form with only a select element and no submit button. Upon change, I issue an ajax call to retrieve the details of the selected Project. Everything works as expected, however after I leave ...
0
votes
1answer
15 views

Cannot get value of form field of type 'file' in drupal form

I have a form field such as , $form['fileTransfer_settings']['file_path'] = array( '#type' => 'file', '#title' => t('Choose file'), '#size' => 22, '#description' ...
1
vote
1answer
25 views

Use profile2 fields in custom form

I'm trying to add profile2 fields in my custom form. I have created a path in my custom module in hook_menu() and in page arguments inside array, I have passed my custom_form. In my custom_form I ...
0
votes
2answers
38 views

How to get selected Value in the listbox by using form api

I have created a form with fields titled State and City. After selecting the state's appropriate city records, they will be loaded into city listbox. Until now they were working fine, but after ...
0
votes
1answer
23 views

How do I conditionally add a field?

I'm trying to find out any example of adding new conditional field using ajax in Drupal 8 form API, but I can't find it. This is my code. $form['name'] = array( '#type' => 'textfield', ...
0
votes
0answers
30 views

How to restrict submit handler when ajax button is clicked in altered form

I am altering ubercart "uc_product_add_to_cart_form" and adding an ajax button "calculate price": $form['price_calculation']['calculate'] = array( '#type' => 'button', '#value' => ...
0
votes
1answer
25 views

How to redirect user after submitting an article?

In Drupal 8 I would like to redirect users to the frontpage and display a status message after submitting an article? How can I do that? form_alter and custom submit handler?
-1
votes
0answers
17 views

File upload on custom form using Ajax [closed]

I want to achieve the following: Upload multiple files using a custom form. Show upload progress for individual image. (not the default drupal progress bar but an ajax/jquery one) Submit the form as ...
0
votes
0answers
14 views

AjaxRenderer Error [closed]

I am using Address module to create address field in profile and enable profile as "Include in user registration form". Here i am facing error while changing the country Recoverable fatal error: ...
0
votes
1answer
40 views

Create dynamic textfield?

I have a form builder containing the following code. $form['finput']['noreff1'] = array( '#type' => 'textfield', '#title' => t('No Reff1'), '#size' => 60, '#default_value' => ...
0
votes
1answer
23 views

Receive error message for radio buttons .“An illegal choice has been detected. Please contact the site administrator.”

I have created a multi step form, in which I have added radio buttons dynamically by using data from the database. The radio buttons added here are not required. But still I get the following error. I ...
0
votes
1answer
21 views

How can add Contact-Us-form in custom place of page.html.twig file? [duplicate]

I need to add contact-us form in the custom place of page.html.twig file in my themplate, I want to add some code like belove: <div class="Contact-Us"> <p>Contact Us</p> ...
0
votes
0answers
13 views

Input values of fields added NOT by ajax are not present in $state['values'] nor $state['input']

I have a form with the default set of fields on page load and with buton "add product". That button is appending the same set of fields into the form. Every set of fields has a button "calculate ...
0
votes
1answer
46 views

How to store Ajax Return value into variable after clicking the Submit button

I have created form with fields of State and City. After selecting the state appropriate city records will be loaded into city field till now working fine but after clicking the submit button I am not ...
1
vote
1answer
23 views

How to set Form API link href to # hashtag

In Form API when creating a link, the output a-anchor will have a prefix of "en/" in front of whatever I set as the href value and if href is set to "#" it will be output with the language prefix and ...
1
vote
1answer
14 views

How to alter a form base on the users' request info?

I would like to customize a form base on the users' request info in a page callback. I use drupal_get_form (or node_add for node create form) to get the renderable array, but most changes to the array ...
0
votes
0answers
28 views

How do I change a form name attribute to something else?

I'm using a Drupal 6 custom form, and I want to change the form name attribute to something else. Is this possible? For example, I have this. <input type="text" name="field" maxlength="128" ...
0
votes
0answers
29 views

FormState getValue on checkbox elements in hierarchical / tabular form structures broken?

I can't seem to retrieve correct posted checkbox form element values using an array-style key in a call to the FormState::getValue method. If I flatten the elements into a non-nested structure, the ...
2
votes
1answer
88 views

Controller and Form

What's the key difference between: amazing_forms_contribute: path: 'amazing-forms/contribute' defaults: **_form: '\Drupal\amazing_forms\Form\ContributeForm'** _title: 'Conribute page' ...
0
votes
0answers
8 views

Specific links do not pass PCA test

I have a Drupal 7 site. It is HTTPS enabled. When I do a PCA compliance test, some of the links that refer to /sites/default/files/styles/* fail the test. The fail message says "..plain text ...
0
votes
1answer
26 views

Best way to store not publicly viewable data? [closed]

I wanted to know what is the most suited to store not publicly viewable data? Here is an example what I want to achieve: Imagine having a personal section about me. On this site I show the visitors ...
1
vote
1answer
42 views

How do I alter the options in the add menu link checkbox in the node edit form?

I am hooking the node edit form with hook_form_node_page_edit_form_alter(). How can I alter the available options when adding a menu item for that node? I need to only show menu items of given node ...
0
votes
1answer
36 views

How to change node add form

I'm wondering how I can change the layout of the node add form in Drupal 8. in Drupal 7 I worked with Panopoly and could overwrite the url in Page Manager and add a Panels Variant. I thought it would ...
0
votes
1answer
24 views

Ordering Table by column

I try to add the possibility to order by column in the header of my table element. I started to use Drupal 8 and I can't find any clear documentation about table on the API site to do what i want... ...
0
votes
2answers
33 views

Dependency injection not working custom form

I have a custom module with a form class, where I am trying to inject a custom service to use within it's submit method: namespace Drupal\my_module\Form; use Drupal\Core\Form\FormBase; use ...
0
votes
0answers
16 views

Auto submit form with argument from URL [duplicate]

I have Drupal module with a form and it works just fine (/my_module/search) I need menu hook for my_module/search/% and to be auto submitted and repopulate the form with the argument form url. So ...
0
votes
1answer
18 views

#ajax callback uses the wrong callback

I don't know why, but using this code, when I click on the marker-category-add-submit button, it executes the type_callback callback, and not marker_category_add_callback. Why? If I comment all ...
3
votes
3answers
35 views

Can I add a field collection to a block?

I have made a field collection, exported as a Feature and now I'd like to add it to a block. Does anyone have any suggestions? I have added fields to blocks through the form API, but that doesn't ...