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

learn more… | top users | synonyms

0
votes
0answers
9 views

How to add a column to a table using hook_form_alter()

My client needed thumbnail images in the nodequeue list. I found a patch that worked beautifully (https://www.drupal.org/node/1806614#comment-6620974). Now the client wants this functionality on ...
0
votes
1answer
18 views

Field rendered invisible when code block enabled

I have this weird issue when altering a webform. Below are two versions of my code: function tubitekuz_form_webform_client_form_97_alter(&$form, &$form_state, $form_id) { ...
0
votes
0answers
11 views

table theme not working

I'm trying to change the way administration page of comments, I'm trying to use table theme but it is not working, show a blank white page. I'm trying theme registry alter. Here I'm splitting the form ...
0
votes
1answer
8 views

Show advanced search form outside fieldset

When I search for a keyword in core Drupal search, it shows a results page with a link named Advanced search that hides a fieldset with more form options. I want it to be shown in the basic search ...
0
votes
1answer
24 views

How to pre-select items in a select with chosen

How do you load a select with items preselected when the chosen module is installed/enabled? I'm doing the following: $my_list = array('item1' = 'item1', 'item2' = 'item2', 'item3' = 'item3'); ...
1
vote
0answers
10 views

Creating a semi-static default date field (fixed month and day, year=NOW)

I have a date field that needs an unusual default date: fixed day and month, but year=thisyear. That's outside the standard default date options. I didn't want to write a custom module for one ...
0
votes
0answers
21 views

Unsupported operand types in form.inc

OK, this ought to be easy but I've been trying all sorts of ways to get this to work. I'm getting this error in trying to insert a value from the $_SESSION array. I've hunted to determine how to ...
0
votes
2answers
13 views

How to form_later the user profile form to only allow 1 role to be assigned/removed

I want to restict my site editors ( a role ) to only be able to select/deselect the role 'subscriber' and not be able to meddle with the other role assignments. I have tried the following to remove ...
0
votes
1answer
23 views

Overriding user profile form

So I have this function: /** * Implements hook_form_FORM_ID_alter(). */ function my_module_form_user_profile_form_alter(&$form, &$form_state, $form_id) { dsm($form); } What I want to do ...
0
votes
0answers
6 views

How to add KnockoutJS to Drupal forms?

Does anyone have experience on adding front-end framework to Drupal? From my experience I see few problems FAPI and field/input attributes for KoJS dynamically added inputs: fapi doesn't allow ...
0
votes
1answer
37 views

What is wrong in my code for replacing the text of 'add to cart' button?

Can somebody tell me what is wrong in my code, please? I'm trying to replace the regular text for 'add to cart' button for two types of product. I'm using Drupal Commerce module. But something is ...
0
votes
1answer
25 views

Why are hook_form_alter updates being reverted?

After I clear all caches I can see my update is effective in the Create Article form. Great. But as soon as I refresh the page, or come to it afresh to create another Article, the unmodified value ...
0
votes
0answers
10 views

Post to Pardot hook_form_alter On user_register Form Not Working

Alright, so this server I'm working on is running Drupal 6 and I need to send form data to Pardot upon user registration. I followed the answer on This Question, while adjusting http_build_query to ...
4
votes
2answers
64 views

Restricting View access for Drupal Commerce Line Item field based on Role

I have a Order page which displays set of line items: However, my client wants me to remove the "Responsible Vendor" from display for Authenticated users but it should be displayed for Admins / ...
1
vote
1answer
25 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
32 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
20 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
1answer
46 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
27 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
24 views

Add the autocomplete functionality in date field [closed]

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
22 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
18 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
35 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
21 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
41 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
20 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
17 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
58 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
32 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
26 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
33 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
35 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
64 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
83 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
115 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
49 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
32 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
235 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
71 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
58 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
38 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
36 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
51 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
52 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
28 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
35 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() ...