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

learn more… | top users | synonyms

0
votes
1answer
9 views

Is there a 'text or user reference' module?

Currently, I'm planning on using a text field for full names (added fields field_profile_full_name and field_profile_partner) on user entities, so that one user can link to another. However, I might ...
0
votes
0answers
17 views

How to set default value of select list field on add node form?

I am trying to set the default value of a select list field on a node add form. The field name attribute in the HTML of the form is: field_state[und] The ID of the add form is: ...
1
vote
1answer
23 views

Form is not rebuilding on “Add another item” in unlimited value entity reference field

In a content type I have a field of type 'entity reference', 'auto complete' widget with unlimited values. The whole idea was to give user an option to add referenced node items but only once, Hence ...
0
votes
2answers
29 views

hook_form_FORMID_alter not working

function send_xml_form_user_profile_form_alter(&$form, &$form_state){ $form["#submit"][] = 'send_xml_edit_account_submit_function'; drupal_set_message('<pre>' . ...
1
vote
0answers
23 views

Webform: change the way each component is displayed?

What I'm trying to achieve: I want to show my webform so each input would be displayed on separate page (kind of wizard or form with steps). I know that usually this is done by adding page breaks at ...
1
vote
0answers
31 views

Disable form altering for admin pages on Bootstrap 3

My default theme is Bootstrap but I use Shiny theme as admin theme. Bootstrap theme alters the forms and fields. And I use Hierarchical Select module, there is a dropbox for multiselection and the ...
0
votes
0answers
16 views

Remove collapsible fieldsets from form Getlocations

I'm a bit a novice to hook_form_alter(), I've watched some screencasts and did read some documentation. I've a form with a search box created by the Get Locations module, which is rendered in a ...
2
votes
1answer
74 views

When using hook_form_alter to modify a content type's node add / edit form, where do I put the #states property?

This is actually a compound question. All in all the question is: When using hook_form_alter to modify an existing content type's node add / edit form, where do I put the #states property, and, ...
2
votes
1answer
37 views

How do I use the form hook alt to edit fields of inline entity form?

I am trying to use the hook_form_alter to modify the fields of an Inline entity form in a commerce product display node. I know how to edit a normal field but this does not work for an entity form ...
0
votes
1answer
25 views

Value from ajaxified form field not passed to ajax callback

This is a continuation of this issue, where I couldn't get the ajax to fire on an entity reference field in a node edit form. With the following code, I'm able to get the ajax to fire. /** * ...
0
votes
0answers
23 views

Remove disabled menu links from menu settings

I have a multilingual site, and when adding content theres an option to add a menu link. Both languages show up in the drop down selection, my goal is to hide/remove the links that are "disabled" (NOT ...
-1
votes
2answers
82 views

Combine two functions [on hold]

How can I combine two functions? Now I get the error: Cannot redeclare xxx_form(). As example: function node_example_form($node, $form_state) { return node_content_form($node, $form_state); } ...
1
vote
2answers
54 views

How do you change the email recipient of drupal 7 webform based on checkbox value using hook form alter?

How do you change the email recipient of drupal 7 webform based on checkbox value using hook form alter? I have a group of checkboxes (Texas, DC, Maryland, Virginia). I would like to change the ...
0
votes
1answer
29 views

Show hook_form on specific content type Drupal 7 Programmaticaly

How can show a form that is created with the drupal _hook form api, on a specific content type? So, as example: I created new content for the content type 'outside' when I click on save I see the ...
2
votes
1answer
49 views

D7 form field #ajax callback not called on autocomplete field

I have an entity reference field, and I'd like to do some ajax so that when a value is selected for that field, some text is displayed in a div below the field. Since it's on a node edit form, I'm ...
1
vote
1answer
22 views

change jQuery version with hook_form_alter?

How to alter js using hook_js_alter inside form alter function mymodule_form_alter to just changing jQuery version based on form ID
0
votes
1answer
25 views

Wrapp every form item select with div, excluding label

im trying to wrap form item with I had success with hook_from_alter and #prefix #suffix that is wrapping whole element with div like this: I used this hook: function em_form_alter(&$form, ...
0
votes
1answer
53 views

How to use form_alter to add class to custom input field in user_register_form

I want to add class to input element of custom filed in my user_register_form. Field is: <div class="field-type-text field-name-field-personal-best field-widget-text-textfield form-wrapper" ...
0
votes
0answers
45 views

How to alter the Drupal 7 webform results edit form?

I have created a form by using Webform and altered the form using drupal hook_form_alter. It is working fine. But when I am trying to edit the already inserted results from Webform submission, I am ...
0
votes
1answer
22 views

Zendesk Webform hook_alter

Im trying to alter the module "zendek_forms" It states: There are four fields in the form (name, e-mail, subject, and description), but more fields can be added in hook_form_alter and the submit ...
0
votes
1answer
16 views

Alter Registration Form Text

I am trying to alter the email description text on my user registration page. I have added the following to the bottom of my template.php file but nothing is happening. It seems like the function ...
0
votes
1answer
20 views

Trying to alter SKU field on ubercart product that is also a course

I'm trying to modify a course (from the course module) and a product (from ubercart). I want to remove the SKU (right now I'm just testing how to remove the required bit) and a few other fields as I'm ...
0
votes
1answer
50 views

Why is hook_form_alter() not setting default values in _after_build function on /node/add/myct in D6?

I've got a validation form (id="mymodule-myct-verify-form") that retrieves data from temp_node to populate it's hidden fields. On submit, the form sends its data to /node/add/myct. (currently via ...
0
votes
2answers
40 views

How to assign default values ​​for an edit form?

In my form I create a field of type list (with the widget box is checked). By default, this field has no value. In my hook_form_alter () method, I add options (via PHP) has this field. ...
2
votes
3answers
109 views

How to add a form_token to a login form

For security purposes, I need to add a form_token to the login form. However, when (in hook_form_alter) I use the same code Drupal uses in form.inc for other forms, the validation fails because the ...
0
votes
0answers
28 views

to make couple fields collapsible

There is a form in which I have couple fields that should be collapsible. Before I have used js in my form for some contend that I added via form alter. $("#something").click(function(){ ...
2
votes
3answers
110 views

User register and login functions are called from hook_form_alter, but user isn't logged in

Background I'm attaching the user register form, to the node create form with hook_form_alter. that way I create a node and user at once. In order to validate and register the user, in ...
1
vote
1answer
35 views

How to set value in form validate for later validation functions [closed]

Problem I'm adding the user register form onto the node create form with hook_form_alter. The problem is the first step of account validation always fails because Drupal doesn't save Username to ...
2
votes
1answer
37 views

How to set form element order with field_attach_form (and why does it do it?)

Problem I'm attaching the user register form to the add node form using hook_form_alter (for a custom content type). (Forcing an anonymous user to register when they create a node.) My solution to ...
0
votes
1answer
23 views

Appending extra columns to Views table

Can anyone tell me if there's a way to use hook_form_alter, or some other approach, to insert an extra column with to a views generated table. I am trying to insert some buttons which will update ...
2
votes
2answers
41 views

Form Submission values in Hook Form Alter method

I wrote a custom method to do some set of operations when a webform is submitted and that is working fine. However I need to access some fields values that has been submitted in the Webform. The ...
1
vote
1answer
18 views

Appropriate theme function for alter specific field for a view

I have used a view in my drupal. In this view, I have used an "add to cart button" field. In my theme, I am searching for a theme function in order to alter this field. For example want to remove ...
0
votes
0answers
52 views

Edit inline entity on form before save

I need to save an inline entity on a node before saving the node for the first time (ie. on the "create node" page). I'm using the Inline Entity Forms module. I have a custom module that creates the ...
0
votes
0answers
15 views

How to change the column labels of a view dynamically using hook that can be implemented in any modules?

For some reason I have to display same view several places with different column names. But, I have to change the column names of that view to some other by URL. I tried hook_views_pre_render() but ...
0
votes
1answer
44 views

Hot to pass an argument to #ajax['path']

I have a form with a radio buttons (inside div#edit-field-nomination-und). I need to call a following AJAX callback: function _onfit_ajax_get_term_description_callback($term) { return array( ...
3
votes
1answer
66 views

Trying to disable mail on contact form, but it's still required on submit

I am trying to make optional the mail field from the contact form. I manage to remove the asterisk by implementing the hook_form_alter: function contact_field_form_alter(&$form, &$form_state, ...
0
votes
0answers
4 views

Community Accounting: filter 'partner' field in 1st party transaction form by organic group

Using organic groups, I have made groups in which people can exchange goods and services, using the 'worth' field in 'offer' nodes and transactions of Community Accounting. I would like the 1st party ...
0
votes
2answers
71 views

Appending a hidden input value to a textarea value?

So basically what I need to do is append a hidden input value to the text-area without overriding the original texarea value on submit. What am I doing wrong? This is in the template.tpl file. ...
0
votes
1answer
156 views

get form_state values from ajax callback through hook_form_alter?

I'm having a little problem with my drupal 7 module. I'm trying to get the $form_state['values'] from $form['base']['st-volume-pricing']['price'] and $form['base']['st-volume-pricing']['till-amount'] ...
0
votes
2answers
45 views

User registration form: Give username “username n+1” value, if and when n is already used

I'm using the first & last name in the user registration form to generate the username for the new user: $firstname = $form_state['values']['field_firstname'][LANGUAGE_NONE][0]['value']; ...
0
votes
1answer
125 views

Programmatically disabling webform component - Drupal 7

According to hook_form_alter doc for webform, I can target the component's properties using $form['submitted']['component_name'], etc. This works fine for altering title, weight, description. The form ...
0
votes
1answer
30 views

Add product(s) to cart from DOM string

short version: how can I add multiple items to a cart from a served string that provides the product ids and their quantities? I suppose a rule could handle this somehow? long explanation: hey ...
0
votes
0answers
16 views

Altering validation messages for node add depending on the field of another content type

I have a node_add form of content type A which is called from the node of content type B. I'd like to alter the validation messages for node content type A depending on the field value of node content ...
2
votes
1answer
70 views

How do I add a Site Information variable and make it multilingual?

So I've used form alter to add in a site information variable (which auto-saves because it's a system_settings_form), but I can't seem to get it to show up as multilingual. Here is my form alter to ...
1
vote
3answers
143 views

Commerce: How to act after quantity change in cart?

I am writing a Commerce submodule that needs to run some code on the line items in an order when the Update Cart or Checkout buttons are clicked in the shopping cart form, but I'm not sure where to ...
0
votes
0answers
18 views

Advanced Search form drupal 6 - missing content type and taxonomy terms

a while back a change was made to stop certain content types such as page and blog and a taxonomy term appearing on the advanced search form. I believe this is the default search form (.../search). ...
0
votes
1answer
63 views

Text field will not save after moving it from commerce billing profile to account fieldset in checkout

I am having difficulty moving a text field from the commerce billing profile entity to the account fieldset on the checkout page. No matter what I do the text field is not saved after moving it back ...
0
votes
0answers
29 views

how to modify display of drupal 7 content type node form?

I have a field with radio buttons as options. By default drupal lists these options each in separate line. I want to modify the display of these options as html table so that I can have about 4 items ...
0
votes
0answers
67 views

Which hook_node function should I implement to set the value for a field collection element?

Or do I have to set it somewhere else? The context is that I am using an ajax callback function in a payment content type to set the values of a select list based on the value of another select ...
0
votes
1answer
40 views

comment form custom validation

I am using a custom validation in my Drupal 7 comment form.I want to match the comment_body against a word "example" so if someone just type "example"in the comment body then it will show a error ...