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

How to pass php variable to js file in Drupal 8

I have the following function in modulename.module file in Drupal 6. drupal_add_js(array( 'take_control_fb' => array( // 'pubKey' => variable_get('take_control_public_key', '')...
0
votes
0answers
7 views

Targeting values within an stdClass variable

I'm trying to target a value in an object in my form, but Drupal throws an error when I try. The object I'm trying to target is the 'amount'. However, when I try to dpm the variable in question, '...
0
votes
0answers
7 views

Form ajax add more button added via another ajax callback not working

I have a form button which I want to add another field with another button on that form( I am able to do this) but second button is not clickable. Any idea. Following is my code- This is my form code-...
0
votes
0answers
10 views

HTML5 media element in Drupal 8 form [duplicate]

I'm trying to add a video element to a form like this but nothing is displayed: $form['camera'] = [ '#type' => 'markup', '#markup' => '<video id="camera" autoplay></video>', ]; ...
0
votes
1answer
8 views

Ahah helper alwas getting error, but on other page no error

I have forms with Ahah helper. When I tried to fill the form, it always getting this error: warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'A' not found or ...
0
votes
0answers
28 views

How to give load page iframe in form elements? [on hold]

I have a iframe form element in the form builder class as follows . But it html pages are not getting loaded. This is the code I used. 'example one' => [ '#type' => 'inline_template', '...
0
votes
0answers
15 views

Fetch a value of field from field settings form in hook_preprocess_field()

I am inserting the fields from hook_form_FORM_ID_alter() in field config edit form. Now I want to get this value of field in hook_preprocess_field(). How can I achieve this? function ...
0
votes
1answer
6 views

text_format field value not appearing in full_html mode

I'm using a block plugin to display content based on what the user inputs into a form. Select boxes, and radio buttons are saved and displayed in the form just fine but the text_format field isn't ...
0
votes
0answers
17 views

Webform confirmation message is not being saved

When I change webform confirmation message it doesn't save in db and shows the last state. The dpm($form_state) in webform submit function shows that confirmation text in $form_state['input'] and $...
0
votes
0answers
3 views

Using Automatic Entity Label how to add number if title is already used (unique)

I have setup auto entity label with tokens. All works great. Lets say I have a title e.g. tokens [firstname] [lastname] Displayed as: Tom Cruise But if there are multiple identical titles named "Tom ...
-3
votes
0answers
12 views

How to get dynamic elements value in form api drupal

I have written code to display fields in dynamic text-field, but I cant able to get all values what I have entered function payroll_emp_form($form,&$form_submit) { for($i=1; $i<=2;$i++) ...
0
votes
0answers
21 views

Drupal 8: Add fields from another form to a existing form in a widget

I am trying to build a module that provides a widget. The widget is based on FileWidget and I would like to add some fields from another form to the existing FileWidget form. I would like to save the ...
0
votes
1answer
42 views

How do I extend a configuration form without using hook_form_alter()?

I want to extend some fields in a config form of a module with another module in Drupal 8. I created a config form in a module (e.g. custom_1) and now I want to add some more fields from another ...
0
votes
1answer
27 views

Access the field class from within FieldItemList (D8)

When I would like to get the values inserted in a form, I use: $form_state->getValue('myfield'); If I would like to have some information on the field definition, I use: $form_state->...
0
votes
0answers
10 views

view fill field form

I don't know how to did that, then i tell you some advises. I want to create a view which allow an admin to search an user. The admin can apply some filter and sort the results by params like (...
1
vote
1answer
29 views

How to give iframe in form elements in D8?

I have a form in formbuilder as follows : public function buildForm(array $form, FormStateInterface $form_state) { $appDir = take_control_app_dir(); $extpath = take_control_fb_ext_client_path(); #...
1
vote
0answers
36 views

How to define a custom “node add” & “node edit” forms with ajax based fields (file fields)?

I created a custom "node add" & "node edit" forms, everything work well except with ajax fields (I noticed the issue with file fields and image fields). When I try to upload files on my custom ...
0
votes
0answers
15 views

Weird error when dsm($form) [duplicate]

when i go in my submit handler of my form if i do a dsm($form) or dsm($form_state) i get a weird error... (i have never seen this before). Here is my code : <?php /** * @file * Alter the ...
0
votes
2answers
22 views

How to use access callback for user role in drupal

How to use access callback for user role in drupal form API? For example User Role Administrator Authenticate User Anonymous user Teacher I want to view particular page for Teacher role users ...
0
votes
0answers
34 views

hook_form_submit isn't called

i've build a form but the callback isn't called (but it is initialized)... My module name is : fritr_register_friterie My form name is : fritr_register_friterie_form My form validate name is : ...
1
vote
1answer
17 views

Change ID of webform hidden element

How can I change the ID of a hidden element (created with the Drupal 6 webform module) using hook_form_alter()? The ID that it outputs is something like '#edit-submitted-component-name'. I need the ...
0
votes
1answer
30 views

Issue for translating button value (with AJAX callback)

I think I found a issue in Drupal 8. I set my form by attaching a ajax callback on a button (not submit, an HTML button). If I translated the value of the button, the Ajax request crash without ...
0
votes
1answer
23 views

Call to undefined function entity_create()

i try to include a node creation form by a field attach form. So i try to load the entity of a custom content type created by the back-office with is called 'friterie'. But when i call the ...
0
votes
0answers
24 views

Google CSE module search form removed

In Drupal 6, the Google custom search engine module provided forms for the search box and the search results. It appears that these have been removed in Drupal 7. I reinserted the 4 functions below ...
4
votes
2answers
72 views

How can I block users from registering with disposable email addresses?

I have a site where users send messages to one another using the Private Message module, and they are notified of messages by email. On this site, there are a variety of spammers, scammers, and ...
3
votes
1answer
26 views

Programmatically added comment form on node page doesn't work

I have attached a view which displays comments to basic page content type using EVA module. I've also implemented the following to have the "add comment" form displayed just above the comments list: /...
0
votes
1answer
37 views

how to create a custom form and embed it on a node

Right now, I want to create a form which only have an email textfield and a submit button. This is what I did in my "custom_request_price.module": function custom_request_price_form(&$form, $...
1
vote
0answers
18 views

Error When Clicking - Add Another Item - An AJAX HTTP request terminated abnormally [closed]

On drupal 7, I have a problem with a form. Render content type form in drupal 7 everthing working fine but I created a Field Collection, when I click Add another item this error occurs /***********...
1
vote
2answers
34 views

Post form to external URL

I need to POST the data in a form to an external URL. In Drupal 7, you would use $form['#action'] = url('http://example.com', array('external' => true)); Or maybe this was for GET. Anyway... in ...
0
votes
2answers
34 views

Cannot Disable User Programmatically With user_cancel()

I want to disable user using user_cancel method. //A function that disables a user. function myid_admin_disable_user(){ try{ $edit = array( 'user_cancel_notify' => true,...
1
vote
2answers
36 views

How to programmatically display a select list label instead of the value?

I created a select list box in the following format Gender 1|Male 2|Female I want to display the follwing information in a table but I am getting "1" for male and "2" for female. Here is my code: ...
0
votes
0answers
9 views

Is it possible to override a form theme function (for example theme_textfield) for a specific theme?

Is it possible to override a theme function from form.inc, for example theme_textfield(). I am trying to override theme_textfield() or theme_form_element() functions as we can do with theme_field() ...
0
votes
1answer
10 views

How to pass along current $form_state for an #upload_validators callback?

I have a managed_file #upload_validators callback and when it is called the $form_state does not get passed along with it. My goal is to use another field in the form to rename the uploaded file. I ...
1
vote
1answer
23 views

How to make user registration form in multistep? [closed]

I want to make a user's registration form in multistep in drupal 7. I was using Profile2 module but unfortunately there were coming some issue. Please give me suggestion except profile2 module.
0
votes
0answers
11 views

How to use theme_form() function in tabledrag form after ajax call?

How to call theme_form_name_form() function after ajax call? I have a table with drag & drop feature, and I want to add one more line after clicking the button "Add one more". Here is what my ...
0
votes
3answers
50 views

how to get field type from form_state

how do i get field type (e.g textfield, option, etc.) from form_state public function validateForm(array &$form, FormStateInterface $form_state) Cheers, AnD
1
vote
1answer
24 views

Change contact form to email based on selection?

I am attempting to change the email a custom contact form is sent to based on what selection the user makes when filling out the form. Is there a way to do this in Drupal 8?
0
votes
0answers
24 views

Change the check box values in user edit form

I have two user roles. builder and buyer. I create a vocabulary called notifications and create many terms. I specify each term with permission- for which use can see this notification. When a user ...
1
vote
1answer
17 views

Create a non admin area form to update user form

I'm trying to see if there's an example of a form that isn’t in the admin area and is used to update user details. Is it possible to create this type of form? Where can I find such an example?
0
votes
1answer
38 views

How can I override default theme_fieldset() function?

I am trying to override the theme_fieldset function in a custom node edit form where the fieldset is added dynamically. Here is what my code looks like: function cms_content_edit(){ $node = ...
1
vote
0answers
46 views

Use a custom JS modal to confirm changes made on node add/edit form before submit

I basically want to do what confirm_form does, but in a custom modal (I am gonna use a JS plugin to generate the confirm modal). So what I have is a large hook_form_alter, and I am using the ...
0
votes
1answer
38 views

How do I programmatically insert the entity ID?

I have added extra fields on the drupal 7 user registration form and created a module with a hook_form_alter function so that i can alter one field in the registration form. in the same file i also ...
3
votes
1answer
26 views

customize login block markups

This is sample modal sample of boostrap modal <div id="signin" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="...
1
vote
1answer
42 views

Drupal 7 hook_form_alter and submitting the form

I added some custom field so that i can get more information when someone registers into the website but i want to alter one field on the form. I created a module which has a hook_form_alter function ...
0
votes
2answers
31 views

modified value in form_state but it is not being saved

in the validation of my form i pass the form_state by reference and I modified the form state value of one of the fields with $form_state['values']['field_total_payment']['und'][0]['value'] = $...
0
votes
1answer
23 views

Why is hook_forms form callback not reached? [closed]

In my custom_apps.module file I'm trying to implement the same form multiple times with different ID's and for that in a loop I call for: drupal_render(drupal_get_form('driver_route_'.$delivery_nid, $...
0
votes
2answers
27 views

How do I add a “Please select”/ “none” option to a required select input in a form?

I cant find anything about that in the drupal 8 form api on how to add an option "Please select" to a select element. The form item is mandatory so you must select something. Of course, selecting "...
0
votes
1answer
13 views

Error before executing the submit handler

i've made a custom form by including into it a node creation form and the user profile form. But when i try to submit my form i get this error : The website encountered an unexpected error. Please ...
1
vote
1answer
16 views

How to prevent closing CTools modal window with ESC during AJAX?

How can I prevent closing CTools modal window with ESC key during AJAX request?
1
vote
1answer
36 views

Programmatically create a comment form for a node

I'm trying to port a theme from Drupal 6 to Drupal 8, and I find code like the following. $edit = array(); $edit['nid'] = $node->nid; $form = drupal_get_form('comment_form', $edit)); How do I ...