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

learn more… | top users | synonyms (4)

0
votes
0answers
18 views

Manipulate login Form in Drupal 8 [on hold]

I want to manipulate user login form(add email)in Drupal 8,I tried with this link http://www.foreach.be/blog/how-manipulate-forms-drupal-8 but no result , I want the form appears on my site with a ...
0
votes
1answer
25 views

Formatting email sent with Contact form

I created a custom form (adding some additional fields) using the Contact module from the core of Drupal 8. When I submit the form is sent an email containing all values, but it is really bad ...
0
votes
0answers
13 views

Alter element_info and troubleshoot changed elements

Ubercart defines the following uc_price type in uc_store_element_info: $types['uc_price'] = array( '#input' => TRUE, '#size' => 15, '#maxlength' => 15, '#autocomplete_path' => ...
1
vote
0answers
23 views

Theming forms. Form-element

Please, help. Is it possible implement different templates for form-element.html.twig? For form 'user-form' one template, and for other forms second template.
1
vote
1answer
26 views

Where are all the controller classes instantiated?

In Drupal 8, if I want to create a form, I have to define a class inside the module folder like this. class MyForm extends FormBase{ public function getFormId() { return 'my_form'; } ...
0
votes
0answers
5 views

How can I validate a fieldset or individual fields with ajax?

On my user registration form I have multiple fieldsets, and I want to validate each fieldset individually before moving to the next one. Kind of like a multipage setup, but all on one page. Is there ...
1
vote
0answers
19 views

How to use form ajax so a click on checkbox “A” posts the content of textfield “B”?

I'm trying to get the value of textfield "B" when checkbox "A" is toggled. Both fields are wrapped in a fieldset who's content is replaced by the callback output. So far I can get both fields to ...
0
votes
1answer
16 views

How to pass variables to OpenModalDialogCommand

Drupal 8. Clicking the upload button on Form1 should open UploadForm in a modal dialog. /** * Callback to display a modal. */ public function ajaxSubmit(&$form, FormStateInterface $form_state) ...
0
votes
2answers
26 views

How do I alter the submit function?

I want to do array_unshift for submit function in D8. Array_unshift working perfectly for validate function but not submit function. Below is my code: function example_form_alter(&$form, ...
1
vote
1answer
20 views

How do I load the node edit form?

To load the login form I am using the following code. $form = \Drupal::formBuilder()->getForm('Drupal\user\Form\UserLoginForm'); I would like to load the form to edit a node. How can I achieve ...
1
vote
1answer
19 views

Drupal8 - Templating a all form in detail on same page template

I need to display a form with complex HTML structure in my custom module. And not a single field had the same wrapper structure. So I need more flexibility in my template custom.html.twig than just ...
0
votes
0answers
6 views

custom link and field update

I'm wondering if and how it can be done. I'm having a dashboard built. Basically, a quicktab using views. In one of these views, there are "custom fields" where I show icons. Some are basic edit link ...
0
votes
1answer
11 views

Generate form from XML

I have a standard form structure with fieldsets etc. I'm trying to populate my form into various nodes. This means that the same form will be displayed on more than one nodes. For every node, the ...
0
votes
2answers
19 views

add a webform in a product checkout

I would add a webform in the checkout step of a particular product. I need this feature because sometimes the products that i offer needs more information and sometimes the information that i need are ...
0
votes
0answers
17 views

How to add addmore/remove buttons for some fields?

I have a flight ticket booking Drupal 8 form which has the following: From To Date I need to include two buttons (Add more and Remove) which will add/remove the above mentioned fields in my form. ...
0
votes
1answer
16 views

How to delete file using drupal_form_submit?

I'm using rest services with a custom resource on node update, i want to build the correct variable node structure to delete one of the files on a file image multiple fields. I removed the file ...
-1
votes
0answers
17 views

Where is the review form for Bazaarvoice module stored?

Where is the review form for Bazaarvoice module stored? Can it be easily modified?
0
votes
0answers
13 views

hierarchical select not working in multistep form

I have created multistep form with help of link and created hierarchial select in step 1.It is working for step 1 but when i click next button and goes to step2, and return step1 it is not ...
0
votes
0answers
11 views

How to authenticate email to send emails with Webform?

Context: I have a Drupal 7 installation and I have a contact form Webform. Webform is configured to send an email to 5 recipients each time you do submit the form. Problem: When I submit in my form, ...
0
votes
0answers
3 views

ajax(jsonp) validation return boolean for using in jquery validation plugin within Drupal

I'm trying to do a jsonp call to backend and validate a unique number. I want the success callback to return true/false since the jQuery validate plugin expects a boolean value to display error ...
1
vote
1answer
21 views

How do I display a help text with field form?

Is there a way to bring up a help message next to a form field as below? FooForm.php $form['field_foo'] = array( '#type' => 'textfield', '#title' => t('Foo'), ...
0
votes
0answers
20 views

Core's ClassResolver cannot find my custom module class, gives InvalidArgumentException

TL;DR: see error message at the bottom. Yes, this is the very basic question on "How do I make a simple custom form" using Drupal 8.1. I have read through 3 different sites and still having ...
-5
votes
0answers
25 views

Where do i Put this code? jquery or other? [closed]

$form['some_element']['#attributes']['placeholder'] = t('Some placeholder');
1
vote
1answer
50 views

How do I change text on submit button in the node form?

I'm trying to change the submit button text "Save and keep published", but with no luck. I'm using standard hook_form_FORM_ID_alter like this: function mymodule_form_node_news_form_alter(&$form, ...
1
vote
1answer
11 views

How can I programatically add the default AJAX throbber to a form submit?

I'm trying to add the AJAX throbber in core to a form submit button, specifically the Private Message module new message page. Here is my code: function ...
0
votes
0answers
10 views

How to calculate the % amount of a field's value and save as value of another field [closed]

In Drupal 8 I try HARD for simple calculation of insurance remittance with Computed field module and also try for RULE module without luck. Could anybody figure out to me how I could create a field ...
2
votes
1answer
70 views

How to display external data using custom form in a Drupal page? [on hold]

I have created a form custom module for get data from an external url. $requestType = drupal_http_request('http://www.example.in/php/example/getSampleType.php',$options); $loomType ...
1
vote
1answer
14 views

How to access individual items in $form_state['values'] post-submit

Question After a user has a submitted a form how do I determine how to reference individual form field values in $form_state['values'] ? Examples For example, I have several fields in my form, such ...
0
votes
1answer
36 views

Can't loop through $form_state->setErrorByName?

I want to display an error message if the form field is empty. public function validateForm(array &$form, FormStateInterface $form_state) { $entry = array( 'name' => ...
2
votes
0answers
24 views

FAPI #prefix YAML filter tag

button_submit: '#prefix': '<div class="col-md-4 text-right">text<button>button text</button>' '#suffix': '</div>' '#value': Send '#type': submit I have the code ...
2
votes
1answer
35 views

Please explain caching in complex render arrays

The Scenario In hook_block_configure(), I'm displaying a configuration form to users that is represented by a fairly complicated render array. The purpose of the form is to allow users to configure ...
0
votes
0answers
23 views

Add a class to parent taxonomy terms only

I have some working code that first capitalizes all the parent terms. Now I need to add a class to it so I can finish styling per requirements. // Module to capitalize the parent name on node/add. ...
0
votes
0answers
12 views

How to return values to widget form from view in ctools popup?

I'm writing custom field type and widget based on it. It allows to create custom entities from node page and add node references on existing nodes. There are no problems with custom entities they ...
0
votes
1answer
23 views

how to add checkbox value as json data in drupal 7

I have created a custom module for a form. And I have json data which I want to add as checkbox values. $request = drupal_http_request($url); $jsonarray =drupal_json_decode($request->data); ...
1
vote
1answer
18 views

Changing an exposed filter to use check_plain() or filter_xss()

I have a view with a search filter. I am using Acunetix scanner to scan for vulnerabilities, which reports me an issue about the search filter. How do I alter it to use ...
0
votes
0answers
16 views

How to return values back to parent form from view in ctools popup?

I'm writing custom field type and widget based on it. It allows to create custom entities from node page and add node references on existing nodes. There are no problems with custom entities they ...
0
votes
0answers
11 views

Using ajax in form api to insert a view on select list change requires 2 change events to start inserting/replacing content

I'm embedding a fullcalendar view into a node edit form. When the user first lands on the form, he/she does not see a calendar and is prompted to select a room first. Issue: On the first room ...
0
votes
1answer
21 views

How do I embed a custom node creation form inside a view

I have these nodes : Company, Cars, Trucks (cars and truck have a taxonomy term to give it's type). Cars and Trucks have a field named Company wich refer to the Company node. So i can locate the ...
1
vote
1answer
28 views

Getting User Entered Form Data within a hook function

Problem I need to use the following hook function to edit a similarly-named function in a contributed module (PayPal WPP), but I don't understand how to use it. ...
0
votes
0answers
11 views

Drupal 7 CCK add form theme customization

I would like to customize the node add form of the CCK theme for these reasons: It is a very large customization job. I'd like to place my fields in my own way instead of trying to do this with css. ...
0
votes
1answer
18 views

How to add custom input type button in forms?

I want to add custom input type button in form. I tried following code, but it is converting it to submit type button. How can i add input type button ? $form[custom_button] = array('#type' => ...
0
votes
0answers
14 views

How to change the edit form layout for custom Field Types in Drupal 8

I created an Address custom field type, with two text fields street and city. When I add a new field of type Address on a content type I get this form inside the edit page: How can I change the ...
1
vote
0answers
22 views

How to display json and curl result in a form

How to dispaly json and curl data in drupal custom form. When I try to display the output it shows in top of the home page.. Actually I expected to show display it in a block or page. I am using REST ...
0
votes
0answers
5 views

qTips do not appear on content type create form

I have installed qTip (Stylish jQuery Tooltips) module v7.x-2.0-rc3, but I cant get it to work on a content type create form. The steps I've followed are the following: Install and enable qTip ...
0
votes
0answers
8 views

How to pass query parameters to paged table using PagerDefault

I have a custom report that generates a report in table format as a marup element in a form, and I have it paged using $query->extend('TableSort')->extend('PagerDefault')->limit(50) I also ...
2
votes
1answer
59 views

Determining the $POST variables of a submitted form

I have a form on my site. Users fill out the form and submit it. When I want to target one of the fields in the form with a custom module I'd target it with something like the following: ...
1
vote
1answer
26 views

How can I save form data on a node in Drupal?

I want submit form data and save on specific node but I don't know that how to do? function test1_menu() { $items['mytest'] = array( 'title' => 'My Tes', 'page callback' => ...
0
votes
1answer
11 views

how to create condition form element in form in drupal 7?

I have created a custom form in drupal 7 with selectbox and autocomeplte input field. Its working fine.. My selectbox have 5 options. <select id="edit-finder-location" name="finder_location" ...
0
votes
1answer
8 views

Add more fieldset with remove option custom module

I'm developing custom module and there's one fieldset that can be added multiple times and can be removed any particular entry also. Can anyone please suggest to achieve this? Here is my code: ...
0
votes
1answer
21 views

Fetch user's realname (from Name Field) within database query (or an alternative method)?

I'm building a custom field for a form based off of the values stored in a user reference field. The options for this field are being built from the following database query: <?php // Fetch the ...