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

learn more… | top users | synonyms (1)

0
votes
1answer
13 views

#default_value not being displayed in form

Here's a function that returns a form: function myfunc($str) { $form = array(); $form['header text'] = array( '#markup' => '<h2>blah blah blah</h2>', ); ...
0
votes
0answers
8 views

multi step form drupal 7 [duplicate]

How can I create multi step form in Drupal 7? function module_template_menu(){ $items = array(); $items['them-noi-dung'] = array( 'title' => t('Khai báo hóa chất'), 'page ...
0
votes
0answers
9 views

Add Brightcove field through form in custom module [duplicate]

I'm using Brightcove Video Connect 7.x-6.0-beta2 module and I want to add field in my custom module. I was tried with brightcove, brightcove_video and brightcove_field types and it is not working. ...
0
votes
0answers
29 views

Why is in_array returning a true value

I've created a module that connects to Salesforce to pull information into an array and then the serial number is entered through a form. The problem is all values are returning a TRUE value even ...
0
votes
4answers
30 views

Hide fields on node edit form

Is it possible to hide fields on node edit form? I've tried Formatter Field but it doesn't work for me. I know it's possible in content type field display management but I need this functionality on ...
0
votes
1answer
25 views

Reading textarea values per row: what is the Drupal internal method?

If I'd like to create a textarea field for a admin configuration form that would include different configurations on multiple rows then how can I read these values/rows? I know there must be a ...
0
votes
2answers
18 views

Displaying hook_form

I have implemented a hook_form in my custom module and I can't figure out how I can get the form to display. Here is my hook form: function data_retrieval_form($node, &$form_state) { ...
2
votes
3answers
45 views

How to dynamically populate select options in system_settings_form?

I'm trying to build an admin form for a module, using system_settings_form(). I want the users to be able to select sub-options, from a list that is dynamically generated depending on the main ...
0
votes
1answer
11 views

Simplenews - how pass values from own input

How I can pass value from added input to database(?) in Simplenews? I want to use this value later in newsletter, e.g. print it in block template. Below is how I created field function ...
1
vote
2answers
26 views

What is the good way to pass a value from form creation function to its submit handler?

I am newbie in Drupal, I have a query that i want to pass some value from form creation function to its submit handler. Right now, I am saving that value in a form element of hidden type. ...
1
vote
1answer
23 views

How to use form field only once

I'm looking for solution for following scenario in my D7 site. I have form with 2 empty text fields. If user enters value in field 1 and submits form next time when he opens this form only field 2 ...
0
votes
1answer
33 views

Setting #title or #description in node_form_alter

I have have a field of type container that is acting as a title field, see complete definintion below. My issue is that I cannot seem to modify the title or description via form_alter, I have tried ...
0
votes
0answers
13 views

themed node add form cannot render form properly

I would like to theme a node add form with the id of "project-node-form". I followed the steps I found online too add the hook theme code in the template.php under the theme and there seem to be ...
0
votes
1answer
32 views

How do I prevent a page from reloading after form submit?

Im trying to edit the poll module to prevent the page reloading after every form submit. no matter where I put $form_state->disableRedirect() when the button is clicked the whole page reloads. ...
0
votes
1answer
36 views

How do I keep unique form id for ajaxified form?

I have a form(which is extending the FormBase class) that requires entity as argument(but I am not manipulating with this entity so that's why I am not using the EntityForm which is irrelevant to this ...
1
vote
1answer
19 views

insert read-only multilingual text to user registration form

I've added a 'Term of use' read-only description into the Drupal user registration form, but I would like to make it multilingual. The corresponding code is in the begin of template.php (responsive is ...
0
votes
0answers
26 views

How to apply css to the $form['heading'] in the multi step form? [on hold]

I am trying to apply CSS to the $form['heading'] in the multi step form. I want to change the css of the div when i move to next form. Below is my code <?php function ajax_form_menu() { ...
2
votes
0answers
39 views

How to tell if user selected an autocomplete option in a form?

I created a form that has an autocomplete field of registered users and it is attached to nodes. In the form validation function I check if the string of the textfield is a valid user but in order to ...
0
votes
1answer
30 views

Where is source code of advanced search form?

I can't find where in Drupal 7 search module is the source code of advanced search form that appears on search result site. Below is code of search_form. You can see there is basic key in renderable ...
1
vote
0answers
23 views

Getting checkboxes to display in three columns [closed]

I have a form with a long list of checkboxes (in an exposed filter form) and want to show the boxes in three columns. This should be an easy CSS issue, but it's not working consistently. Strangely it ...
0
votes
1answer
24 views

Associated content

I have 2 content types: a subscription and a renewal_request. I would like to have the possibility for the user to create a renewal request from the subscription page (or from a view of subscriptions ...
1
vote
3answers
90 views

Is there a real-time inline field validation module?

Currently I'm using the Clientside Validation module for validation of my fields, but I want to be able to have per field real-time validation. Like a check thingy showing if it's correct or a small ...
0
votes
1answer
34 views

How to set attribute for checkbox field

I want to add the attribute data-toggle="toggle" to a checkbox field. I thought I could use the hook theme_checkbox which is: function theme_checkbox($variables) { $element = $variables ...
2
votes
3answers
60 views

Add javascript to a content type form in Drupal 7 [duplicate]

I'm trying to add a custom javascript file to my article content type forms (add/edit). I've tried mythemename_preprocess_page, hook_form_alter and theme_content_type_node_form to no avail. They ...
0
votes
1answer
25 views

My form validate function will not run.

I am using Organic Groups. That module has a form where you add new members to a group. I would like to run additional validation on that form. I use hook_form_alter and can identify the form. I add a ...
1
vote
1answer
24 views

Book outline in custom form

I am creating a custom form which creates new nodes of type 'book'. I have been able to get the "book outline" to render on my form using $nid = $node->nid ='nid'; module_load_include('inc', ...
0
votes
2answers
43 views

Collapsible fieldsets in form using button

How can I make a button collapse a fieldset in my custom form? I tried the following which did not seem to work: $form['stepone']['next'] = array( '#type' => 'button', '#value' => ...
1
vote
1answer
27 views

Ajaxly set Text Field Value with Drupal Forms API

I have a text field and a ajaxified link in my form: $form['id_number'] = array( '#title' => t('ID Number'), '#type' => 'textfield', //textfield '#suffix' => ...
0
votes
2answers
46 views

How do I get parameters from form redirect?

I've made a form and I'm trying to get the submit result into a redirect page with URL api: public function submitForm(array &$form, FormStateInterface $form_state) { ...
2
votes
2answers
60 views

Overriding Drupal core base class

I need to override the block configuration form in Drupal 8. To override the configuration form for a new block we are creating can be done by implementing BlockBase::buildConfigurationForm method. ...
0
votes
4answers
134 views

submit custom form drupal 7

I've created one custom module to display product review form on custom created block but i'm not able to submit form and also I can't see form name while I checked with inspect element. give me ...
2
votes
1answer
41 views

How to add javascript after form was validated with ajax callback?

I created a simple form. How could I add JavaScript commands after form was validated? Why is it so hard do this? $form['submit'] = array( '#type' => 'submit', '#value' => 'submit', ...
0
votes
0answers
14 views

Drupal form ajax focusout

Why drupal does not fire focusout/blur unless I change the value on the textbox? I need to execute the callback no matter if the textbox it's empty.
0
votes
0answers
7 views

filter_xss() stripping out specified $allowed_tags (Drupal 7)

I'm busy building my first ever module, and I've hit a bit of a snag. On my form, I allow the user to input some SVG image markup/code. I then use AJAX to load this input into a wrapper DIV below it ...
0
votes
1answer
29 views

How to get values after form submit

I created on custom module to generate a form with this code function report_page_form_form($form, &$form_state) { $meberArr = array(); $form['field_member_org']=array( ...
0
votes
0answers
28 views

Get ID name from form input field and reuse

I'm trying to figure the best way to get a form id from the search block form for example. I want grab the id that's in the input field and insert that name in my label tag. For example <input ...
2
votes
1answer
42 views

hook_form_alter based on path

I don't know if this is possible but could I do something like <?php $foo = current_path(); print $foo; ?> in page--foo.tpl, then something like function ...
1
vote
5answers
120 views

How to get the $form_state in hook form submit?

I need to create a node when a comment is submitted in nodes. There are two content types image and memory and I need to get node ID of the node that a user is inserting comment in it. Here is my ...
0
votes
2answers
27 views

How can I add a second submission handler to a form to run after the default handler node_form_submit

I need to generate a node of a dependent content type when creating a node of the primary content type. I have successfully created the function to be called and attached it to the form and it ...
0
votes
1answer
11 views

How can i load a table on changing a select option using AHAH callback

I have drop down in a form as follows and i want to load a table of data using the drop down value , here is i have tried , function list_user_form(){ $form['howmany'] = array( '#title' ...
0
votes
1answer
23 views

Add prefix to the error message

How I can add some prefix to the all error messages? Example: This field is required! and I need Error: This field is required! I'm using Clientside Validation module for error messages in my ...
0
votes
1answer
41 views

TimePicker Rendered by an Ajax Callback Function Doesnt Show Up

I have a select form element that fires an ajax callback function everytime its value changes. $form['template_options'] = array( '#type' => 'select', '#options' => array( 1 ...
0
votes
1answer
30 views

Custom user_register_form for Auto Assign Role registration pages

I'm using a function[a] to get custom templates to work for all pages, including role registration pages set by Auto Assign Role. By setting the role registration path to ...
0
votes
1answer
56 views

How custom a form with twig

I make a form programmatically, and I am looking how a web designer can change render. public function buildForm(array $form, FormStateInterface $form_state) { $form['metier'] = array( ...
0
votes
1answer
19 views

Drupal Ajax breaks after one fire

This is a very frustrating and recurring problem for me because it seems to come and go at random, one minute it is working beautifully, the next moment I make a change and it breaks. Even if I ...
0
votes
0answers
18 views

Render admin forms in a node body?

I have a node and in body field I'm giving a token as [form:node_page_form]. On saving the node, it iterates the token and render the node add form. I could render login form, registration form but ...
0
votes
1answer
38 views

Display date picker not inline in Drupal 7 Forms API

I have installed Date Picker Module and it works fine. Below is the code: $form['date'] = array( '#title' => t('Select your birthdate'), '#type' => 'datepicker', '#date_format' ...
1
vote
2answers
71 views

Custom nested element and its child sub-elements callbacks

I'm trying to create a custom element that consist of a few other elements, namely some select box and one timeperiod element. I've set up custom #process, #value_callback, and #element_validate and ...
0
votes
1answer
37 views

Sending data via post and redirecting user

So I made a module that needs to gather some data and redirect user and that data to a payment site. function payment_upload_form($form, &$form_state){ $form = array(); $form['#action'] = ...
1
vote
3answers
43 views

Changing node/%/edit title

I have created custom content type for upload the details. I have used hook_form_alter to set the node title as "Upload". When I edit the node in node/%/edit the title remains "Upload". I want the ...