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

learn more… | top users | synonyms

1
vote
1answer
19 views

using hook_form_FORM_ID_alter with #states

I am trying to use checkboxes to display inline entity form elements only when the boxes are checked. However, my code doesn't seem to be working. It will hide the element, but when I toggle the ...
0
votes
1answer
29 views

Change field input type on node edit form

I'm looking to change the input field widget on my form, but still accept the same value at the end of it. I have an integer field, and I only want them to be able to select certain integers which ...
0
votes
1answer
16 views

How to override “action” of a form?

after a form submission I want to redirect to an url. The "action" attribute of the form is ['#action']=homepage. How can I override this? I have used this code function ...
0
votes
0answers
15 views

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

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 ...
0
votes
1answer
24 views

Use form_alter to add placeholder text to a Views Exposed Filter min/max field

I have an exposed "List Price" field in a View using the "in between" operator (so that users can search for content between this price and that price), and I need to add the text "Min Price" and "Max ...
1
vote
0answers
22 views

D7 forms: select values from a select list when a checkbox is checked using ajax

In a node form I have 2 fields, the first one consisting in a list of regions, the second one consisting in a list of countries. The needed behaviour is that when I click (let's say) "Africa" from ...
1
vote
0answers
23 views

Add the autocomplete functionality in date field

I want to add autocomplete functionality in date field. I tried using form alter but it doesn't catch & by using hook_date_text_process_alter, it works in date field but not for first time. It ...
0
votes
1answer
15 views

Redirect to custom error page if node submit fails validation

I've embedded a node/add form on my homepage for submissions but for caching purposes, I need to have any server-side validation occur on a different page instead of itself. I.e. If the form fails ...
0
votes
1answer
17 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
31 views

Need help with AJAX callback function for text field validation in form_alter

I have an existing form with a User field $txn_user for capturing the User by name using the standard autocomplete. So I guess that's a User object, right? We have many thousands of users and the ...
0
votes
1answer
15 views

Make field editable in comment form

Could you please help me with the following task? I need to make the existing field (name Clarify, type select - "clarification required/clarification isn't required") to be editable from display view ...
0
votes
2answers
19 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
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
13 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
16 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
52 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
1answer
25 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
19 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 ...
0
votes
0answers
17 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
25 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
17 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
26 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
34 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 ...
1
vote
0answers
27 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
47 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
69 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
96 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
44 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
28 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
171 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
70 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
52 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
37 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
30 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
38 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
47 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
24 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
34 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
158 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
39 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
90 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
75 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
200 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
48 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
23 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
67 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
41 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
39 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
212 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
49 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, ...