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
10 views

How to set a default value for Simple hierarchical select?

I tried to implement hook_form_alter in order to pass default value to Simple hierarhical select views exposed filter. function mymodule_form_alter(&$form, &$form_state, $form_id) { $tid = ...
1
vote
2answers
37 views

How to add css class to these form fields?

I wan to be able to add certain css class to all the text fields in my content edit forms. here is a picture of what i can see using Devel: Those arrays under the "Und" are for the fields I want to ...
0
votes
0answers
14 views

Theme settings logo upload file field: how to apply a max file size validation? [closed]

I want to apply a max file size validation to the upload logo field in appearance/settings/my_theme So I thought using hook_form_alter would have sort it out: function ...
1
vote
1answer
23 views

How to change label pass field on registration form

I need to change the password field label on the registration form. Name and Email I changed through hook_form_alter and password does not work. Help me! $form['account']['name']['#title'] = 'Имя ...
0
votes
1answer
10 views

form_alter: Inline entity Form

I am using IEF and all is well...until I try ad implement hook_form_alter() and when I access the form via IEF UI (as opposed to directly modifying the entity) none of the changes I make appear to ...
0
votes
0answers
30 views

How to use theme functions in .module files?

I am trying to override theme_radio and theme_radios directly in MY_MODULE.module file. For this purpose I declared these functions: 1) /** * Implements hook_theme(). */ function ...
1
vote
0answers
21 views

Help with form select options and sorting of values

I have altered the log-in form to my client's specification and I'm having problems with the display and sorting. As you can see, I have a select list called Organization. That is the Username Text ...
3
votes
2answers
50 views

How to adapt #prefix/#suffix for each option in radio form using hook_form_alter()?

I need to modify the html code of radio buttons generated by Ubercart Attributes. So I want to do it using hook_form_alter(). If I dsm() the $form I need to change using hook_form_alter() I get ...
0
votes
1answer
31 views

how to modify and the location of modified hook_form_FORM_ID_alter

I am learning to add a checkbox to registration form about agreeing to terms of use, found in modules/system/system.api.php, line 1708 I found an information here in modifying the ...
1
vote
0answers
18 views

hook_form_alter node menu and path settings

I have 2 problems which I have been trying to solve using hook_form_alter. I need to have the Provide a menu link, Indicated in the image below, checkbox selected by default on particular nodes. I ...
1
vote
3answers
35 views

Hide the Drupal /user/register form from spam, but leave open registration to Commerce/Ubercart

Commerce/Ubercart require account creation to buy product. That's fine - I want that. But I do not want user/register open to the public. Efforts to use Honeypot/Captcha/Mollom are still letting in ...
0
votes
1answer
18 views

using hook_form_alter on a same form from 2 different modules

How will a predefined form behave if we have two different forms that implement hook_form_alter? I would explain my question by an example, because currently I got a crash on it: I have a predefined ...
0
votes
1answer
24 views

validation of text box and checkbox

I am trying to validate the form. I have one hidden textbox and one check box group. field_institute_event - represents checkbox group. posted_student_list - represents hidden text box. If both ...
0
votes
0answers
26 views

AJAX not works (added in form_alter hook) in a view via views_embed_view

I have a view with a form (this is a commerce card - commerce_cart_form). I have added some AJAX to this form with form_alter. When I open this view direct by path - all works fine. But when I open ...
1
vote
1answer
68 views

hook_form_alter function to make field visible and required?

I'm trying to build a hook_form_alter function to make field visible and required. The form is the checkout form at http://example.com/en/checkout/33 The targeted field are Customer Profile Billing ...
1
vote
3answers
53 views

How to set a value for date field

I need to set value for a date field with type datetime in hook_form_alter. I tried with below codes. But it is not worked. $form["field_event_date"]["und"][0]['#default_value']['value'] = ...
0
votes
0answers
43 views

Form wont submit using AJAX when logged out

I am trying to submit the Add To Cart form using AJAX, I have altered the form like so: function ajaxcart_form_alter(&$form, &$form_state, $form_id) { if(strstr($form_id, ...
0
votes
0answers
15 views

form_alter hook in a ctools content-type plugin not called

I'm writing a ctools content-type plugin to use it as a panels pane. In my plugin code I try to use the form_alter hook at render for the login_form (not for the edit forms). But the hook seems not to ...
0
votes
2answers
67 views

Form submit handler not working

I'm developing a pretty basic module catalog_request that creates a form. I'm replacing the form's default submit button <input ..type="submit" /> with a <button ...>click</button> ...
1
vote
2answers
57 views

How to modify a term reference autocomplete field

I am using a term reference field but the widget type is autocomplete term widget. This term consist of many levels as parents and child. In the form I need to display only the child terms(only the ...
0
votes
1answer
23 views

Need help on adding options to $form via select field

I altered the username field in login block into a select field and now I'm trying to filter the usernames by their user roles via another Select Field. function design_form_alter(&$form, ...
0
votes
0answers
34 views

Facet API - Rewrite facet items via callback function

I'm trying to rewrite the link text in an Apache Solr facet block, specifically the one to drill down by bundle/content type. By default the block displays the human readable name of the content type. ...
0
votes
1answer
44 views

Change Login Form:Username to Select Text

Is it possible to change the login form? Specifically the Textbox for username to select text? Let's say I have 4 users named: User1,User2,User3,User4 and when select text is clicked. All users will ...
0
votes
2answers
58 views

Hook Form Alter Specific Node

I want to put a hook to a form on one specific form that I created. Based on Node ID. The code i currently have is . function jhumobileform_form_alter(&$form, &$form_state, $form_id) { ...
0
votes
2answers
27 views

Form Alter Foreach Loop changes not sticking

I'm trying to modify my exposed filter block to put each of the controls inside fieldsets, and make other modifications to them. However, when I try to utilize a foreach loop to do this, none of my ...
0
votes
3answers
42 views

Drupal_add_js is not working inside hook submit

I have alter and hook submit for webform. I would like to pop a modal if form is successfully submitted. But drupal_add_js seemed to be not working inside the hook submit. function ...
0
votes
1answer
99 views

URL variable not respected when ajax call happens in user registration form

There are some fields (some required, some not) I need to (conditionally) hide in the user creation form: function hook_form_alter(&$form, &$form_state, $form_id){ switch($form_id) { ...
0
votes
0answers
30 views

Programmatically change input filter of term description on taxonomy_form_term

I couldn't find anywhere on the admin UI where I can change the input filter for term's description field. I have tried using hook_form_alter, but wasn't successful. function ...
0
votes
1answer
35 views

How can I add a field in Entityform / hook_form_alter

I'm trying to add a field to the form in hook_form_alter. What's the proper way of adding fields in this hook in case of entityform? I tried to add it this way: $form['leadname'] = array( ...
0
votes
2answers
27 views

Altering button title it becomes inactive

The override function I use in my bootstrap sub-theme template.php: function subtheme_form_titles_node_form_alter(&$form, &$form_state) { $form['actions']['submit'] = array( '#type' ...
0
votes
2answers
24 views

How to compare new node title with already entered nodes in database

I am using node gallery module.While creating an album, when the user enters duplicate name then error message is displayed as This form requires that the fields Album name, Author are a unique ...
0
votes
1answer
29 views

Alter form button title

I use this to alter field labels: function ninesixty_form_user_login_alter(&$form, &$form_state) { $form['name']['#title'] = t('Name'); } But how do I change the title of the button? ...
0
votes
0answers
34 views

How to set the body field as required?

I want to create a forum module. Im using Drupal 6.0 and I want to set body field as required field programmatically. $form['body']['#required'] = TRUE; $form['body'][LANGUAGE_NONE][0]['#required'] ...
0
votes
1answer
15 views

Change workbench_moderation_state from select to radio [closed]

I have workbench installed, and want to change the moderation status dropdown in the add node form to a radio. But I don't get it. I have a custom module with a hook_form_alter hook which prints the ...
1
vote
1answer
100 views

Alter Fieldable Panels Pane form

Im using Panopoly, and have created a new Fieldable Panels Pane (FPP) bundle for a specific content type. I notice that all preset Panopoly FPP's have a check box labelled 'Make title a link' inside ...
0
votes
0answers
42 views

Alter webform field before it is rendered

I am VERY new to Drupal (Drupal 7). I am stuck at webform alteration step. So, I have created a content type - News. The News content type has a node reference field for referencing a webform. ...
0
votes
1answer
31 views

Webform Module and Elements Module

I have a hook that i wrote to include the elements fields (i.e, telfield) in a webform. The field doesnt take on the same css as the rest of the fields which means I probably need to add a style to ...
0
votes
1answer
38 views

Add an input[type=“file”] label

i need to style the input[type="file"], the only way to really style them is to add a <label> which has the same for value as the input's id. Drupal does not provide a correct label in single ...
0
votes
1answer
74 views

Drupal 7 add ajax listener directly to node form

I'm trying to register an ajax listener to a checkbox on one of my standard node forms. I want to display certain regions of the form only in case, the field is checked. I can get the drupal ajax ...
1
vote
1answer
78 views

vbo: how to set default values for “modify entity values” form

I have a view with nodes and a views bulk operations field. With this vbo field I like to "modify entitity values" of the selected node. Is it possible: to automatically check the checkbox for a ...
0
votes
1answer
67 views

hook_form_alter checking $user->uid == $node->uid

I need to check if the node uid and the logged-in user's uid are identical when the user is in the node edit form, and then add a class to the form if that condition is true.* The relevant code in my ...
0
votes
1answer
34 views

How to alter a form of content-type to prepopulate FieldCollection of EntityReference fields?

I have three content types : Classroom (some fields) Student (some fields and one EntityReference to Classroom) KMDone (some fields and a FieldCollection) KMDone is a content type which contains : ...
0
votes
0answers
18 views

Move email form to different page and confirm password

Im trying to move the change email form to a separate page just like the chgpwd module does with passwords. However the form doesn't actually seem to do anything when submitted. I also want to make ...
0
votes
0answers
28 views

hook_form_alter and unlimited field values

I need to alter the output for fields when the user clicks the 'add another' button for unlimited values. Basically I want to add an incremental counter into a markup field contained within a field ...
0
votes
1answer
20 views

Saving form data of forms modified with form_alter hook

I understand how to add stuff like checkboxes and fieldsets to existing forms (e.g. the form displayed on the node edit page) using _form_alter. But what I don't understand is how to collect the input ...
0
votes
1answer
276 views

How to programmatically enable/disable Quantity text widget on cart/checkout page?

There are the following things which I've investigated so far: Version of Commerce Cart: 7.x-1.9 Shopping cart form is controlled by commerce_cart_form view. Checkout page is controlled by ...
0
votes
1answer
46 views

hook_form_alter to create table field

I created a form which takes user input for fields: title, link, date and description, however I have another field which is guid and it cannot be user created. This field needs to be created with ...
0
votes
1answer
36 views

How to make blocks contextually aware of current webform page

I have a multipage Webform that lives at a single URL and I would like to place certain blocks depending on which page the Webform is on. None of the webform hooks give access to page number, and the ...
0
votes
1answer
36 views

an entity_metadata_wrapper for a form_content in form alter hook?

There a few days ago, someone in this website advised me to use the function entity_metadata_wrapper. Thanks that, I can get and set fields of entity without use heavy code. Now, I would like find ...
0
votes
3answers
61 views

Alter the form elements on profile page

I have a privacy profile & i want to disable text "No fields have been associated with this profile type. Go to the Profile types page to add some fields" in my form also i want to override text ...