Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [forms]

Don't use it for entity or entity field forms.

4
votes
0answers
985 views

Loading a form in dialog/modal returns an error

I have a form with a submit button binded to an AJAX callback that opens up a modal with another AJAX form. The modal dialog opens with the form, but the AJAX submit in that modal form isn't ...
4
votes
0answers
89 views

drupal_process_states function doesn't work for managed_file

The following code is working for text field, but it's not working for image field. function THEMENAME_form_system_theme_settings_alter(&$form, FormStateInterface &$form_state, $form_id = ...
4
votes
0answers
281 views

Execute form custom validator first before default validation

I have added a custom form validation on node/add page in drupal 8. The purpose of adding this validator is to add a slash before the path alias string. By default if a path alias string is added ...
3
votes
0answers
689 views

Ajax Form Callback return 500 Internal Server Error

Build form : public function buildForm(array $form, FormStateInterface $form_state) { $form['service_name'] = [ '#type' => 'textfield', '#attributes' => [ 'placeholder' => t(...
3
votes
0answers
43 views

Multilingual admin interface

I have a multilingual website ( english, dutch and german ). The language detection is setup to look at the URL for both interface and content. This results in an admin interface that goes from dutch ...
3
votes
0answers
601 views

Error saving custom field type module with “managed_file”

I have created a custom field type module (field plugin) containing four fields: title, description, address, image. Drupal version: 8.02 This is the schema structure inside FieldType php file: ...
3
votes
0answers
303 views

Is there any way to add a file field for multiple upload file to a custom form?

I'd like to add a file upload widget to a custom form, with core file module, as shown in the admin edit node page. I've trying with the 'managed_file' API, but I've only got upload one file. I need ...
3
votes
0answers
726 views

Unzip a file in Drupal 7 Form API and upload extracted files

I'm creating a custom form using Drupal 7 Form API, and I need my users to be able to select a ZIP file containing a number of other files. I'd like to be able to extract the files and then upload ...
3
votes
0answers
278 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 ...
3
votes
0answers
106 views

Drupal 7 Webforms 4, prevent submission if value of field is less than or equal to previous submission

I know that you can prevent submission if a specific value has previously submitted. However can you prevent a submission if the submission is less than or equal to a previously submitted value. ...
3
votes
0answers
136 views

drupal_add_tabledrag dragging but not dropping

I am trying to use the drupal_add_tabledrag in a form table, the dragging is added fine, but dropping is not working $entity_ids = range(10,20); // Loading dummy data $entities = entity_load(...
3
votes
0answers
608 views

Webform: change the way each component is displayed?

What I'm trying to achieve: I want to show my webform so each input would be displayed on separate page (kind of wizard or form with steps). I know that usually this is done by adding page breaks at ...
3
votes
0answers
187 views

Disable form altering for admin pages on Bootstrap 3

My default theme is Bootstrap but I use Shiny theme as admin theme. Bootstrap theme alters the forms and fields. And I use Hierarchical Select module, there is a dropbox for multiselection and the ...
3
votes
0answers
425 views

Passing a default value to a custom form element

I have created a custom element through a module. This custom element is a drop down element which reads the values from an array saved in the variable table, which in turn is controlled by a ...
3
votes
0answers
1k views

Multiple date picker for date popup widget

I've been searching for a while, but didn't find any contribute module to store multiple date values picking them from only one date popup calendar widget, just a 2009 feature request for D6. In D7 I ...
2
votes
0answers
54 views

Apply constraint conditionally

I've just started to use Drupal 8's Entity Validation API and I'm applying constraints to entities in the following way using hook_entity_bundle_field_info_alter: ...
2
votes
0answers
467 views

Prevent URL encoding of custom query parameters passed to FormState::setRedirectUrl()

Upon submission of a custom-coded form, I'm redirecting to a URL that includes query parameters. How can I prevent Drupal from URL-encoding those parameters? Example: $params = [ 'something' => ...
2
votes
0answers
49 views

Extra fields for edit form as opposed to front end

hook_entity_extra_field_info() allows adding arbitrary elements to the Manage display tab that also appear on the rendered node. I want to add some section headings that appear on the node edit form ...
2
votes
0answers
120 views

Text_format field value not retained in form

I am using Ctools to generate a popup and I'm loading my form inside it. In order to use a textfield with youtube link embedding and image uploading, I am using WYSIWYG module with CKeditor library. ...
2
votes
0answers
1k views

How to make modal dialog submit buttons work when called with OpenModalDialog()?

I'm having an issue with some modal dialogs in Drupal 8.3.5. My requirement says that when I'm on a particular form under a particular condition, then a modal dialog pops up and collects some ...
2
votes
0answers
244 views

Ajax callback (not triggered) on content added by ajax

The only post I've found about this question is sadly unanswered, so here's my situation. I have a custom form that I made in MyModule. On the send button, I set an ajax call that loads a list of ...
2
votes
0answers
338 views

How to render input inside of label for checkboxes?

I have a form field with a list of checkboxes, but the inputs are outside of the label. Theming requirements dictate that the input must be inside the label, as well as have a span with the form ...
2
votes
0answers
367 views

Render form widget inside a custom form

I'm trying to use the Image Widget Crop inside a form API. I followed the example module but there's no explanation how to do it after a file is uploaded. My form is set like the code below. It works ...
2
votes
0answers
378 views

Upload a file by Ajax without submitting the form

I want to upload a file by Ajax (without submitting the form) than process in backend, and clear the field to allow to add another file. Is it possible with Drupal 8? Can anyone provide an example? I ...
2
votes
0answers
1k views

Entity Browser in Forms API

I'm having trouble getting the entity browser widget to work correctly in a custom form. Just wondering if anyone has had any success in getting it working. I've got to the point the button is ...
2
votes
0answers
146 views

Creating a module: form config class invalid?

I currently have a working module that parses iCal links to events. This part is working. What I am trying to do now is creating a configuration page for my module that allows me to input the link to ...
2
votes
0answers
713 views

hook_form_alter ajax callback never fired

My use case is the following : I've an autocomplete widget to a referenced entity and I want the value of an other autocomplete widget to be selected when the first one is done. I'm aware of this ...
2
votes
0answers
58 views

How do I get back JSON value using entityform?

I am using drupal 7 entityform in this case, as i want CRUD functionality with the form. Can anyone tell me how should i configure my services. As of now i have configured it manually, selected the ...
2
votes
0answers
159 views

Image upload replaced modal

I have a form that has text_format form element with CKEditor in it and it has the image button in toolbar. This form is being displayed via modal. When I click on the image the image upload/...
2
votes
0answers
138 views

How to unset node form select list element_validate?

I added a built-in select list field to a content type but left the allowed values field setting empty, since I'ld like to get the possible options to choose from dynamically. To be precise I'ld like ...
2
votes
0answers
256 views

How do I add an Ajax submit to a Node form?

I have an node form which I am trying to submit via ajax using $form['actions']['submit']['#ajax'] = [ 'callback' => ':submit' ]; The form is submitting properly and the node is getting ...
2
votes
0answers
440 views

Multistep user profile form

How can I have a multistep user profile form in Drupal 8? Using Profile module I can have the tabs for the different sections of the profile, but what I need to have is a single form with steps for ...
2
votes
0answers
126 views

How to remove form validation in D8 under certain conditions?

I'm trying to save a node as a draft, but only if we are saving as a draft (Workbench Moderation). Otherwise, validation should be run as normal. The user must be allowed to save a node in any state,...
2
votes
0answers
497 views

Confirm form for content type

I have a custom content type (books); on submission of the content type, I want to add a confirmation form for the content type. How can I do that? How can I append the confirmation form with content ...
2
votes
0answers
35 views

Setting a #default_value to a select list during Feeds import

I need to set an entity reference select list's #default_value during (or after?) a Feeds import of Commerce products. Two term reference fields are used as arguments in the entity reference view that ...
2
votes
0answers
290 views

Globally increase #maxlength attribute of textfield (form api)

I have thousabds of field for admin to edit data which is saved in db from mobile app. i can fetch those data into text field while editing but drupal having default #maxlength of 128 character but in ...
2
votes
0answers
88 views

Add a non-system confirm popup on node add/edit

I want a custom confirmation popup to come up when someone wants to save a new node or update an existing one. Of course, the form only submits/saves info if the user clicks Yes. As it is now the ...
2
votes
0answers
330 views

how to fetch value from grouped form fields after ajax is fired under conditional select type

I also used dpm($form_state->getValue('input_select','text')); and dpm($form_state->getValue('input_select','body'));its after the ajax handler is called... what is the right way to fetch value for ...
2
votes
0answers
39 views

How to alter form submmision response text

How to alter form submmision response text code below: <?php function response_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'cmis-upload-node-form') { //$form['#...
2
votes
0answers
390 views

Change another input field with ajax callback

I have an existing node with text fields. I want to change another field with ajax; if I input text in text field I need this text appears in another text field. I implemented hook_form_alter() with #...
2
votes
0answers
132 views

Call form validation function by clicking link

I want to be able to click a link on my form and have it call the form's validation function (but not actually submit it!). Here's what I've got that's partially working: in form_alter: $form['...
2
votes
0answers
43 views

Is there a way to get faster dependent dropdowns?

I have a complex node form with a series of dependent dropdowns (pick option a, update choices for option b, pick b, update choices for option c, etc.). It's all working fine with the standard ajax ...
2
votes
0answers
532 views

How to add confirm form with form alter?

I would like to add a confirm form for the edit page of an entity (commerce product in this case), which only appears when an certain form field has a certain value. I did succeed to set up a confirm ...
2
votes
0answers
73 views

Unlimited value field in theme settings

Trying to implement an unlimited value date field in my theme settings, using theme_form_system_theme_settings_alter to add the form inputs, including a button with an ajax callback function, which is ...
2
votes
0answers
100 views

How do I create a comment programmatically in drupal 6?

I have a comment form which gets rendered below the content type on content page. I have a comment form and comments being rendered as well. Now the question is that I have a custom form that takes ...
2
votes
0answers
36 views

fill in content creation form based on view

I have 2 different types of content for users that rely on each other called goals and tasks. The way I have the system set up is that each task must be a part of a goal and this is the view I have ...
2
votes
0answers
490 views

How to force form_state['input'] to form_state['values']

I have a custom form that uses AJAX to add new fieldsets internal users can specify a default set of artists, e.g. 4, and send this to a record label/management etc. the rep can come to the form, and ...
2
votes
0answers
1k views

How to remove readonly attribute from form input element

I have a form with date picker. Its a view exposed search form. i need to remove readonly attribute of this field to edit the field. I tried jQuery code jQuery("#edit-date-filter-value-datepicker-...
2
votes
0answers
92 views

Custom visibility settings not applying

I'm trying to edit a module. It has per role visibility settings that work, but i added code to add per page visibility settings. The settings show in the module ui page but they don't save(they don't ...
2
votes
0answers
981 views

Ajax on submit button not working second time

i am using ajax on my custom module (via example module) the issue is ajax dependable select menu working correctly and the submit button also giving result properly but submit button becomes not ...