hook_form_alter() is the hook implemented by modules to alter the forms implemented by other modules.

learn more… | top users | synonyms

0
votes
2answers
10 views

can hook page alter also do all the things that hook form alter can do..?

Since the page alter hook also has information about individual form fields is it correct to say that hook page alter can do everything that hook form alter can do
0
votes
1answer
20 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
7 views

Entity Reference View Widget Callback

I have a entity reference field using Entity Reference View widget to select my entities, and a few other fields on my node. Those other fields are dependent on what is selected in the View widget. ...
0
votes
2answers
13 views

How can I hide one commerce specific shipping option without deleting?

I am trying to hide a couple of Commerce shipping options we no longer use. I can't figure out the proper syntax for addressing the individual form radio options. Here is what I have so far: ...
0
votes
1answer
45 views

How to set the first option as the selected in the SELECT form via hook_form_alter

I have created a Views with an exposed filter and I tried to use hook_form_alter to convert it to a select list. Now, I need to set the default value as the first option whatever output in the select ...
0
votes
0answers
13 views

load mutifield value on button click by passing form field values with ajax

I needed to load field value from an existing node. This has to be done via clicking of button like "load defaults". I know this could be done without button using hook_form_alter while form is ...
0
votes
1answer
22 views

Missing my custom ajax field values by image field in node form alter

I have created new content type and added two taxonomy reference field (select list) both referenced to same vocabulary "car" and one Image field with cardinality = 6, In car vocabulary listed brands ...
0
votes
0answers
13 views

Custom HTML output of site wide contact form

I'll display site wide contact form in block, probably using some additional module because I didn't find any solution for that. Now, I need to have exact HTML output of entire form, here is the HTML ...
-2
votes
0answers
20 views

how can i add specific field to my form render

I am not very advanced in Drupal development, but I develop custom forms for different modules. I have a form with several drop-down menus. In a specific drop-down menu, several tabs will appear ...
0
votes
0answers
11 views

Field widget item form alter for file field

I want to alter field widget item form of a file field with cardinality > 1 so that a new form element is added to each row of the file tables. For example, in the attached image, I want to add ...
0
votes
1answer
22 views

Is entittyfieldquery result can be loaded into select list?

Trying to populate select list in VBO action form (basically could be anyform) and using enityfieldquery to get list. By this methods $result object contains node arrays. Can this array can be ...
0
votes
1answer
15 views

new submit button to node form not displayed?

When i try to add a new node of type article for example i want to add a new submit button with new submit function so i did like this in hook_form_alter : function MYMODULE_form_alter(&$form, ...
0
votes
0answers
17 views

List records in table and on click display details in form

I created a website which has two menus in it. One is to enter details of a person and the other to view list of entered persons. Here is the code function agents_menu(){ $items=array(); ...
0
votes
1answer
31 views

alter the exposed form , make field hidden and accept it through node form field

can it be possible to alter the exposed form , make field hidden and accept it through node form field. for example Both node and views exposed filter will have the common date field and this view ...
0
votes
0answers
20 views

Custom menu with drupal_get_form plus form_alter_hook

I'm working in Drupal 6 to create a custom module. I have a menu that creates some custom URLs and tabs for me, and each item runs a page callback function, which itself runs drupal_get_form. What ...
0
votes
1answer
33 views

Can I use hook form alter to add an attribute to a webform field?

I am trying to use hook form alter to add an onchange attribute to a select field but it is not working. Is it possible or is there something wrong with my module code? function ...
1
vote
0answers
59 views

Set user profile fields that are not visible on registration form

Very new to Drupal, first of all. I'm working on a custom module for user registration (we're still in Drupal 6) that I'd like to do a few things: Geocode the user-supplied zipcode to get a ...
0
votes
2answers
75 views

Use CAPTCHA module on a custom HTML form? (no use of Drupal Form API)

Is it possible to use the CAPTCHA module on a custom HTML form created in a content page of a Drupal 7 site? I am not using the Drupal Form API or webform modules. The form has the following code: ...
1
vote
2answers
38 views

In form alter what is the different way of hiding fields and what is the difference between them?

I am currently using the following code to hide the fields in the form 1. $form['field_name']['#access'] = FALSE; 2. hide($form['picture']); 3. unset($form['picture']); 4. ...
0
votes
0answers
17 views

Multi-column checkboxes render the checkboxes as columns

I've found this module https://www.drupal.org/project/multicolumncheckboxesradios to display a long list of checkboxes in columns. I've altered the form to add the required parameter as the module ...
0
votes
2answers
79 views

Add html markup to Drupal Webform

I want to extend the simple text the Webform module allows for radio buttons to include HTML markup. The Drupal Options Markup module purports to add markup to the text for radio buttons. It does, ...
0
votes
0answers
66 views

Adding group content to an organic group doesn't persist after submit action for hook_form_alter

In the submit handler I wrote for my implementation of hook_form_alter for a node edit form, I can successfully add a group content node to an OG using og_group() - og_is_member() returns TRUE after I ...
0
votes
0answers
32 views

Save node and pass field value to registration form page

imagine a homepage with only one field and a save button. I would like anonymous users could fill this field and after clicking on the save button, the user is redirected to user registration page and ...
0
votes
0answers
34 views

Add another set of field collection to the $form in mymodule_form_alter

I am working on custom quiz module, where we have Multiple choice questions. We have created separate field collections for Question and it's options. Author can add unlimited number of question and ...
1
vote
1answer
28 views

Adding a button to a form that links to an external URL

I am trying to add another button to a user login form. I am able to get the button to show up, but not to link to an external URL (example.org in the code below). Code I am using is below: ...
0
votes
1answer
28 views

Drupal 7 Adding additional fields on user registration page, specifically first name and last name

In Drupal 7, what methods are there to add additional textfields to the user registration page at /user/register? I mainly want to also get their first + last name during registration. There doesnt ...
0
votes
0answers
41 views

form_alter and #element_validate inside .module file

Inside my .module file, I have created a hook for alter register_form and add a password field with a custom field-validation: function xenforo_form_user_register_form_alter(&$form, ...
0
votes
0answers
17 views

Problems with a “filter field options on term refernce” ajax callback

I'm having problems with a "filter shops on section" ajax callback, when field_sections (term reference with unlimited values) changes field_shops (entity reference) should show all shops with the ...
0
votes
1answer
30 views

Adding a validation step via hook_form_FORM_ID_alter()

I am trying to add a custom validation function to an existing form. I am using hook_form_FORM_ID_alter() to edit the form. I am then adding a new function to the #validation array. When I use dpm() ...
0
votes
0answers
134 views

Modal form FB login fail redirects to page with Ajax response

Modal popup contains: Login form + Facebook login button. Both the login methods(Login form + Facebook button) work fine for users who's account is active. FB login button is implemented using fbauth ...
0
votes
1answer
35 views

Can we add a new column to field collection in edit form?

I created a topic before with this question, but i write another to be more exact on what i want to do. I have an entity with several field collections and in this field collections, several fields ...
1
vote
2answers
63 views

How do I rewrite the ID of an exposed filter field element?

I am desperately trying to a way that I can rewrite the ID of an exposed filter field element. I've gotten so far as to set up hook_form_alter where I can get the specific $form array that I need. ...
0
votes
2answers
52 views

How to autofill text fields in form?

I have two pages, on the first page, the user types in an ID. Using hook_form_alter, I then override the submit function and add my own functionality that will then grab information from a database ...
0
votes
0answers
196 views

Dependent multiple selection drop down in drupal form - illegal choice error

I'm new to Drupal , in my project I have 2 multiple select drop down box. I don't know how to do dependent multi select drop down action in drupal form alter function using ajax. Single selection ...
1
vote
1answer
36 views

How do I pull a field value from a form field in to my inline entity form?

I'm trying to do something which I would think is fairly simple, but I'm just stumped right now, hoping somebody can help. I have an entity called 'page', and in that entity I have inline entities ...
0
votes
0answers
19 views

Override the “options_list_callback” value for a specific taxonomy term reference field

I want to know if it's possible to alter some term reference fields and use a custom method instead of taxonomy_allowed_values. I have tried this with no success function ...
4
votes
1answer
61 views

Get entity id in hook_form_BASE_FORM_ID_alter()

I am working on porting a D7 module to D8. As in Drupal 8 all things are represented as entity, menu items are also represented as entity. Now I added a hook_form_BASE_FORM_ID_alter() implementation ...
0
votes
1answer
30 views

Alter label with token

I am trying to build a questionnaire that simply replaces (alters) the label of a list-field. I´m doing so by replacing a token from views (embed) and using a hook_alter_form function in an separate ...
3
votes
1answer
37 views

Image field - 'Number of values' is not showing up in admin form

Something's very wierd with my existing Drupal 7 setup (current Drupal version, set up in early 2013, custom Zen Subtheme). When I create a new Content Type with a new Field Type "Image" this 'Number ...
0
votes
1answer
144 views

Custom submit button callback overrides default callback?

I am trying to accomplish the following functionality: I have a profile2 registration form to which I have added a custom form element (just a submit button) using hook_form_alter(). The submit ...
0
votes
1answer
44 views

adding data attribute to option value in Drupal 6

I have a form, like this: $form['my_case_type_list']=array( '#type'=>'select', '#title' => 'Issue Type', '#options' => $my_list, ...
0
votes
2answers
51 views

Make form to show multiple field widgets with predefined values

I have a node form with multivalue field (cardinality unlimited). I need to show user 3 widgets if this field with predefined value (like shown at screenshot). At screenshots I show the current form, ...
0
votes
2answers
124 views

How to soley wrap the <input>-field in a custom <div>-wrapper in Webform 4.x?

I've a fairly simple question. Due to a given CSS I need to wrap the <input>-field (as well as <select> or <textarea>) of webform-component with a custom <div>-wrapper. Change ...
2
votes
1answer
21 views

Commerce module: Why this commerce_order_ui_form_commerce_order_ui_order_form_alter won't work?

I have this commerce order, and I want to hook into it when an administrator review the order (edit it to set it as complete, canceled, or whatever state). I want at that moment to use a specific ...
0
votes
0answers
22 views

Values on select list are not getting saved on submit

I have a select list(Text) with empty (0) values. I'm setting the #options programmatically on mymodule_form_alter. Everything s is being set for the #options, but when i submit the form, the value ...
0
votes
1answer
84 views

Using #states to disable a field collection field

I am trying to disable a date field's second value, inside a field collection, but it isn't working. My hook_form_alter has this: ...
0
votes
0answers
34 views

Drupal 7 Webform add a select field via alter

I am aware of adding fields via the Drupal form API. I am wondering how can I add a field to a Webform via my custom module. In this case I would like to add a select field whose value I would like to ...
0
votes
1answer
62 views

hook_form_alter isn't working

I've been trying to insert a placeholder for my search-bar, so in my page.preprocess.inc I call hook_form_search_block_form_alter(), then specify the form's array, and create the placeholder array, ...
0
votes
2answers
47 views

How to alter a form's name attribute

I'm trying to override the Drupal Login form. I have been able to unset and modify pieces of it, but the last thing I am struggling with is the name attribute on the submit button. Currently, the ...
0
votes
0answers
39 views

Checkboxes not rendering after changing options

I'm developing a module that alters the node submission form to accomplish the following: The user selects a value from an autocomplete field The user clicks a button (add_courses) that shows a set ...