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

Fatal error: Cannot use string offset as an array [closed]

I'm trying to delete or hide the delete button on all my field collection for specifics roles but i got the error : Fatal error: Cannot use string offset as an array in ...
0
votes
0answers
4 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
18 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
38 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
26 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
27 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
26 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
55 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
14 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
22 views

Making text field as autocomplete fields not invoking ajax for second Instance with same set of letters

I have made text-fields to be auto-complete fields programmaticaly using hook_form_alter. This is a dependent ajax, based on country selected, state values will be dynamically showing as ...
0
votes
0answers
14 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 ...
-1
votes
0answers
9 views

How to add save as Draft button with custom callback in custom form

I want a functionality in my custom form: How to add save as Draft button with submit button in custom form. Both Submit Button & Save As a Draft Button will be having different Callbacks. ...
4
votes
1answer
54 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
20 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
31 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
49 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
26 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
45 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
60 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
16 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
12 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
49 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
14 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
53 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
34 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
23 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 ...
0
votes
0answers
23 views

Commerce Product Add On HTML Wrapper For All Linked Products In Add To Cart Form?

I'm using the Commerce Product Add On Module, which uses Entity Reference to insert 'optional' products into the Add To Cart form in the form of checkboxes. I want to create a DIV which encapsulates ...
0
votes
1answer
33 views

How to pass default values on node form through form_alter when using confirm_form?

My confirm form should consists part of node form but with disabled fields. I mean after I submit node form I rebuild it and append confirm form in hook_form_alter()(Before it I change submit callback ...
2
votes
1answer
21 views

How to unset _none option inside field collection?

Normally, in a node form you'ld unset the _none option like so: function MYMODULE_form_FORM_ID_alter(&$form, &$form_state, $form_id) { ...
1
vote
1answer
40 views

Set entity reference field in form to readonly

I am building a custom module to set default values for entity reference fields. To avoid overwriting these defaults, i would like to set the field readonly. While I got the defaults to work, setting ...
0
votes
0answers
18 views

Advanced hook_form_alter #required option

I have a form, build by content type with not required field. To this form i added additional submit button with custom submit function (using hook_form_alter). So the form looks like this ...
1
vote
0answers
19 views

Updating multiple elements in Form Ajax Callback [duplicate]

The Form In a Drupal Form I have (amongst other elements): Two select lists: Retailers, Products. One Table select: Selected Products. Two buttons: Add, Remove The Functionality I want: The ...
0
votes
1answer
56 views

hook_form_alter Add wrapping div around label and input

Using hook_form_alter, for each field I want to wrap a div around the label and the input, leaving the help text (description) separate. Can hook_form_alter do this? Seemingly I can only add prefix ...
0
votes
0answers
18 views

Modify Userpoints List FormTo Show Entity ID?

How does one modify the List used to display userpoints? eg. http://example.com/user/123/points I'd like to be able to modify that (table) to display the Entity ID (the source transaction id). ...
0
votes
0answers
54 views

Unable to alter Drupal 7 webform 4 text and select field values after form post

I have set my webform to reload on submission, then I am checking if the form was posted and on that basis alter the form value. I tried the following: Set Default value to %post['company'] Manually ...
0
votes
1answer
54 views

Using hook_form_alter to enter placeholder in mailchimp signup fom

For the signup form I'm using the Mailchimp Signup module. The idea is to hide the label, which I did using the unset(); function, and put an a placeholder in the input field where people enter their ...
0
votes
2answers
50 views

How to change the field label on my registration form? Drupal 7

On the default registration form, I want to change the Username label to 'Request your username' I tried putting this in my template.php:: function mymodule_form_alter(&$form, &$form_state, ...
0
votes
1answer
69 views

ajax modified form drop down doesn't save

I have used form_alter to add a ajax callback to an element to my form. When the user chooses an option, it creates dropdown options for the other field. However, while this works fine for changing ...
0
votes
1answer
31 views

Add Nested <ul> List into $form

I have something like this. How can I make $upload_items be a nested <ul> list under Upload examples Something like <ul> <li> Upload Ex </li> <ul> ...
1
vote
0answers
64 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
58 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 ...
1
vote
1answer
49 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
87 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
44 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
47 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 ...
4
votes
3answers
146 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
2answers
40 views

how to modify and the location of modified hook_form_FORM_ID_alter [closed]

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
21 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
82 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
29 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 ...