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

learn more… | top users | synonyms (1)

0
votes
0answers
10 views

Detect if user presses the “Enter” Key in a Textfield using Drupal Forms API

I have a simple form with a textfield and a div element: function main_form() { $form = array(); $form['textfield'] = array( '#type' => 'textfield', ...
1
vote
1answer
9 views

Using placeholders in watchdog function

I know this is simple. I have a callback function callback below: function callback($id = '121-01927'){ watchdog('print', '%message : Sample',array('%message' => $id), WATCHDOG_DEBUG, $link = ...
0
votes
2answers
12 views

How do I remove comments from an existing webform?

After the fact, I learned how to make comments <hidden> by default for new webforms. However, for the forms I've already created, there is no option to remove comments. How do I remove comments ...
1
vote
0answers
13 views

D7: Allowing more filetypes to upload and get file value

I'm making a custom form and I want it to be able to upload .pem files. All things I find in google don't work. I already added it into the 2 arrays of file.mimetypes.inc: 1000 => 'certificate/pem', ...
0
votes
0answers
15 views

How to pass an argument in a callback function generated by an ajaxified link?

I have an ajax link in my form element: $form['print']= array( '#type' => 'item', '#markup' => l(t($record_uid), 'admin/callback', array('attributes' => array('class' ...
0
votes
2answers
10 views

Access Denied when Menu CallBack Function is Called

I am trying to call a function after the user clicks on an ajaxified link below. $form['link'] = array( '#type' => 'item', '#markup' => ...
0
votes
1answer
23 views

Custom validation rules for content entity fields

So I want to store an entity_type in a string field in my content entity. Since the list of entities can change over time, I can't use a list_string field with allowed options. I don't know if ...
0
votes
2answers
18 views

Add placeholder or default value to captcha text field

There is a webform in my website, I added the captcha to this webform using this code: function THEME_form_alter(&$form, $form_state, $form_id) { if (strstr($form_id, 'webform_client_form')) ...
1
vote
1answer
35 views

How can I add products to cart programmatically?

I have a form adding an item to the basket in the form of a table n x m where n and m are taxonomy terms of two different taxonomies ('type of the insert' and 'insert size'). In each cell the user ...
1
vote
0answers
8 views

Form with paypal donation!

I am still learning drupal. I want to add a form which collects information from the user and when a user donates using paypal, the info will get sent to an email. Something like Webform Pay module. ...
0
votes
1answer
25 views

Is it possible to trigger an Ajax CallBack Function After a Link is Click

I have a simple link in my form. $form['myid_print']['myid_print_search_idnumber_wrapper'] = array( '#type' => 'item', '#markup' => '<a>Im a link....</a>', ...
0
votes
1answer
51 views

My battle with drupal's form

In the ancient times when things were easy, you just had to code a form in html and then your php would typically have a if($_REQUEST['some_value']) to handle the request. But now with Drupal, nothing ...
0
votes
1answer
29 views

Display Special Characters in Drupal Forms API

I have a variable fetch from database which contains special character ñ. For Example: $student = 'Evangeline O. MontañO'; $student = 'Rosalyn G. QuiñO'; Displaying it in my form causes error/ ...
0
votes
1answer
20 views

Get values from ajax replaced text field in a form

On a edit page I added a form so the user can select what he wants to edit. With that info I used ajax to show the info which belongs to that item. But when submitting the form it isn't taking the ...
0
votes
2answers
24 views

Changing filter plugin settings before they are saved

(This is for D8, although parts of this filter settings API were already in D7.) As far as I understand, a filter plugin exposes its settings solely with FilterBase::settingsForm() - the central ...
1
vote
0answers
19 views

Remove extraneous Symbols/Characters in a variable

I have a variable $student whose value is from the database. When I tried displaying it in a table using Ajax callback function, it throws an error saying: But when I initialized the variable ...
0
votes
1answer
15 views

Ajax HTTP Error Occured in Theming Tables

I have two elements in my form: a select element and a div with an id of #myid_table_wrapper. function myid_print_user_page_form() { $form = array(); $form['options'] = array( ...
1
vote
2answers
34 views

Form returned by drupal_get_form() won't submit

I am currently implementing an additional registration page on my drupal site, using drupal_get_form(), but I seem to be missing something cucial. While the registration form is printed at the path ...
0
votes
1answer
42 views

Passing path arguments to a form builder in Drupal 8

I'm trying to understand how to port the following D7 code to Drupal 8. function x_menu() { $menu['x/form/test/%/%'] = [ 'page callback' => 'drupal_get_form', 'page arguments' ...
1
vote
0answers
9 views

Field Option Set For Nodes Similar To Commerce Product Option Module?

First of all I am not using commerce module, I DID used it but it did not meet my needs regarding multiple carts and a lot more, so I cannot use commerce product option module. but the function of ...
1
vote
1answer
21 views

Get id of selected option in Drupal Forms API

I have a select element in my form. function myid_print_user_page_form($form, &$form_state) { $form = array(); $form['options'] = array( '#type' => 'select', ...
1
vote
1answer
25 views

Update theme table using callback function in Ajax

I have two elements in my form: a select and a table element. Everytime onchange event is triggered on select element, I want to update the values in my table. I want to do query and change the values ...
1
vote
1answer
25 views

form attached JS attributes

I'm trying to convert this: <script type="text/javascript" data-main="/Scripts/submenu/main" src="/Scripts/require.js"></script> into something like this: $form['#attached']['js'] = ...
0
votes
1answer
24 views

Problem seeing form state with form API [closed]

Perhaps my eyes are tired, but can someone look at this code snippet and tell me what he problem is. I'm doing some examples and testing module development using the Form API. function ...
1
vote
1answer
18 views

output same form buttone on same page - drupal_render($form

I try to duplicate form button on the same page. The button is printed like this drupal_render($form['continue_shopping']); The problem is that once I render the button, the second one is not ...
1
vote
0answers
27 views

Modify a node on the submit

I would like to generate a forum for each article posted on the website. Actually what i'm able to do is create the forum before, write the article and match a field with the forum. Now i would like ...
0
votes
1answer
16 views

Custom error for user registration page in D7 not working

I can't seem to figure out why this custom module refuses to execute for user registration validation. I've made sure I'm using the correct form id using firebug, verified the module is installed ...
0
votes
0answers
7 views

How to solve mind-mapping hierarchy in form of a form?

Any suggestions on how to solve the following problem? Okay, I am creating a site in which there is a form. This form has several categories, and in each category, you are creating items. These items ...
0
votes
1answer
18 views

Populate $form_state['values'] with defaults from drupal_get_form()

I'm looking to resave a form's defaults values. In core the test module uses drupalPost() to test the form so I'm thinking this will be custom code.
0
votes
1answer
13 views

Getting form Array from a webform created with Webform module?

Is it possible to easily get the form Array from a webform created with Webform module? I want to be able to call a copy of the form elsewhere thanks
0
votes
1answer
25 views

#triggering_element picks wrong element?

I'm triggering an ajax-enabled button on a form but Drupal's setting $form_state['#triggering_element'] to the wrong element. The button is a child of a #tree and is identical to other buttons in ...
0
votes
2answers
31 views

how to get previous step values in next step in drupal multi step form?

How to get previous step values in drupal in the next step in a multiform. I want to display the values other than drupal_set_message(). I want to use these previous values in other function in the ...
0
votes
1answer
32 views

How to set form action to default contact form action

I'm editing a Drupal site, it has a hardcodeded contact form which I would like to have the same behaviour than the default contact form (applying filters, inserting info in the database and sending ...
0
votes
1answer
23 views

How to add a value to a field via custom button

I was wondering how do you add a value to a field on a form(node/add) via a custom button on views? The scenario: On the form(node/add) a user can see and search a list of venues(view block) and on ...
0
votes
1answer
22 views

Custom form handler not found in Drupal 8 (call_user_func_array error)

Currently on Drupal 8 beta 7. I'm trying to build a form with separate "submit" and "cancel" buttons. The cancel button has some separate cleanup work to do. I've tried to follow the documentation ...
0
votes
1answer
14 views

Tying together creation of multiple content types in a form

I need to make a content creation form that ties in the creation of two different content types. Imagine garage and cars as an example. There is a one-to-many relationship between garage and cars, so ...
1
vote
1answer
36 views

How to update one select element via Ajax when using node_add

I have just created a new content type called pieza_musical. What I just want to do is update one select element via Ajax depending on another select choice, a dependant select. I'm altering the ...
0
votes
1answer
14 views

Using Theme() to output html/javascript in user edit

I have a module that outputs a button to the user edit page. I use the form_user_profile_form_alter to append the button but I want to add html and javascript after it. I saw that the theme() function ...
0
votes
0answers
12 views

How to get form with errors after validation to reload within the original containing DIV

I'm very new to Drupal. I've tried to create a custom theme and edit the way comments are displayed within my nodes. All good so far apart from when my comments are submitted without a textarea filled ...
0
votes
0answers
5 views

Submit function for custom module executes on every page except the user edit page

I wrote a custom module that creates a form and displays it in a block. The form only contains one button that performs an event when you click on it. It works great on every page, but when I put it ...
0
votes
2answers
25 views

Clean URLs work*, but not when I submit forms?

I have a local dev site configured (Ubuntu 14.04.1 LTS), and I copied a production website to play with there. Everything appears to work great. Clean URLs seem to work and I can navigate the site. ...
0
votes
1answer
35 views

Set entity reference field to 'autocreate' directly in the entity field definitions

I'm having trouble with the two ways of defining forms for entities in Drupal (the first one being in the entity field definitions and the second one being by defining a custom form class). Now, in a ...
0
votes
1answer
44 views

Real-time node form

Is there a way for users to see the choices he/she already made on the form on real-time? For example a user clicked a checkbox or radio button and on the bottom part of the form it shows all the ...
1
vote
1answer
21 views

User Edit Page for different elements

I want to customize the user edit page. I want to separate the elements (eg. user password, user picture, user email) and put them each on a separate edit page. I tried the panels module, but that ...
0
votes
2answers
36 views

call specific name of views from module

Below code changes the all quantity label to none. i am trying to change quantity field label for specific views block for ubercart3. (so in product node, quantity labeled as quantity and in product ...
0
votes
0answers
15 views

7 - Add a webform component programmatically with a hook

I have a two step webform, wherein on step 2 based on how many files were attached on step 1, I would like to add that many text fields on Step 2. Is there a way to programmatically add text boxes to ...
0
votes
0answers
32 views

Embedding an entity refenrence add button on a q=node/view page

I am creating a 'Activity Management' site for that I have created Activity and Participant content types. Participant content type has Full Name, Cell No, Email, Address fields and 'Activity' has ...
0
votes
1answer
35 views

Load Javascript when a particular form is loaded

I have the code below in my own drupal module(myid): myid.module file: function myid_init() { drupal_add_js(drupal_get_path("module", "myid") . "/js/myid.js"); } function myid_menu() { ...
1
vote
0answers
60 views

Is it possible to append Media's file browser to a certain node type?

I have a certain node type with a canvas on it, allowing users to draw on the node. Basic functionality such as lines are working, but I'd like to allow people to upload images to it as well. Since ...
0
votes
0answers
25 views

Using form api to store google map location

Is it possible to use form api (write codes) to display and store google map Latitude and Longitude? Most of the modules available is to add new google map field to drupal content type. I don't want ...