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

learn more… | top users | synonyms (1)

0
votes
0answers
13 views

Add special character validation on creating new term when user create a new node

I want to add special character validation on creating new term when user create a new node i am using form_alter() function but they run when user save node i am using simple hierarchical select ...
1
vote
2answers
29 views

Form input returns “1” instead of real value

On this page I have an select list with values from a file directory. This works. Only after submitting it doesn't get the value of it. It makes it "1". Normally with a "normal" select list this ...
1
vote
0answers
30 views

Calorie Calculator with Drupal: There are modules or solutions?

I want to create a calorie calculator with Drupal 7. You should be able to choose different foods and at the end the total calories should be calculated. Are there solutions (modules) - does anyone ...
1
vote
1answer
9 views

Textfield Ajax Callback Function Conflict

I have 4 elements in my form: 2 text field and two search buttons. Below is an image: Code: function myid_print_user_page_form($form, $form_state) { $form = array(); ...
1
vote
0answers
19 views

Get value file_save_upload from $form_state['input']

How can I get the right value to use in $file = file_save_upload($public_file, $validators, 'public://', FILE_EXISTS_REPLACE); $public_file = $form_state['input']['files']['public_file']; This ...
0
votes
1answer
12 views

What's the class or id of the autocomplete suggestions pane?

I'm doing a form with a fairly standard autocomplete_path textfield, like: $form['the_field'] = array( '#title' => t('A title'), '#type' => 'textfield', '#autocomplete_path' => ...
1
vote
1answer
27 views

Profile 2 different types with single edit form

I am using the profile2 module to create different types of information for the user. One of these profile types are filled in on the registration page. What I am trying to accomplish is combining ...
1
vote
0answers
21 views

How to trigger form AJAX callback if the form did not validate?

I attached an AJAX callback to first/last names on the registration form. When user enters both, the callback generates automatically the username and shows it in the form. The problem is that the ...
1
vote
0answers
16 views

How to add another form by using #ahah field?

I have created one drupal form as following : function add_action_item_and_alert_createalert_form($form_state){ $alertahah = 'alertwithahah'; $form = array(); ...
2
votes
1answer
13 views

Option sets for fields?

In my content type I have a products field (entity reference) which references other content types (product content types). What I want to do is each product field has to have a specific option set, ...
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
10 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
3answers
18 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
14 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
16 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' ...
1
vote
2answers
12 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
24 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
21 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
36 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
26 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
33 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 ajax 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
36 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
53 views

Passing path arguments to a form builder [on hold]

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' ...
2
votes
0answers
13 views

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

First of all I am not using commerce module, I DID use 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 that ...
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
29 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
26 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'] = ...
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
8 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
33 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
15 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
40 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 ...
1
vote
0answers
15 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
26 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. ...