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
7 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
15 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
35 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
0answers
7 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
10 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
18 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
2answers
46 views

get nid of created node in custom submit and Page redirect after save

I am using Drupal 7. I have created a content type called person. And I have customize my node person adding form with custom submit button . But uses default Drupal node save function. I just uses ...
0
votes
1answer
18 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
57 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
26 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
2answers
40 views

Which hook invoke on saving Content.? [closed]

Story: I have a content Type "Issues". I have few fields on this content type. I am using function bartik_form_alter(&$form, &$form_state, $form_id) but it fires when I view node and submit or ...
0
votes
1answer
19 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
16 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
54 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 ...
0
votes
1answer
45 views

Node add form alter & submit custom field

I have a content type "event" with a field called "field_pricelist". It's a dropdown with no values, I add the values when I alter the form. The values come from a custom table (install / schema) in ...
0
votes
2answers
98 views

What hook gets called at the formation of a form? (hook_form_alter called for adjusting a form)

what hook gets called at the formation of a form. I'm trying to add some additional mime types to form with id file_entity_add_upload but my hook_form_alter is getting called after these are ...
0
votes
1answer
32 views

Prepopulating county/state field (ajax driven field)

Before I describe my problem, just going to mention that I tried Commerce Addressbook and Commerce Extra (address populate) modules but the first one is not suitable in general for my project (because ...
2
votes
1answer
48 views

Update url query upon form submission

I am trying to append a variable on the URL through a custom submit function. Is that possible? My issue is that I am coming to the node/%/delete from different pages. I want to modify the delete ...
0
votes
2answers
28 views

disable the preview and delete buttons on node edit form

I want to disable the preview and delete buttons on node edit form.I have used the following code.But it is not working. where am i wrong with this? function mymodule_form_alter(&$form, ...
0
votes
2answers
50 views

Prefix html before radiobutton (input field)

I'm looking to insert some extra html before an input radio button. This is my html now: <div id="edit-field-geslacht-und" class="form-radios"> <div class="form-item form-type-radio ...
0
votes
1answer
80 views

How to trigger hook_form_alter() on my custom $form?

I have written a custom module which builds a custom user_profile_form(): mymodule_user_profile_form($form, $form_state, $user) { module_load_include('inc', 'user', 'user.pages'); $form = ...
0
votes
2answers
63 views

dependent dropdowns via #ajax for unlimited option

I have a commerce Product content type, which has a field collection field attached to it field_mycollection, which has 4 different fields field1, field2, field3 and field4 dependent on each other. ...
0
votes
1answer
20 views

How to control path alias in custom node form #validate function?

To change form values in code, I understand that the right way is to add a validate function with hook_form_alter, to append the function's name to the #validate array then use form_set_value. When I ...
0
votes
2answers
40 views

How to alter node form of content-type

How to hook my node form function mymodule_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'node_form') { #Do Something } } I tried above but No result function ...
0
votes
1answer
26 views

How to form_alter fields attached to an unlimited field collection?

Here are 2 unsuccessful experiments I've done: <?php /** * My first attempt with implementing hook_form_alter. */ function MYMODULE_form_alter(&$form, &$form_state, $form_id) { switch ...
-2
votes
3answers
36 views

In form alter change the allowed value list programatically of select box defined using admin content type

I have added a select list field using admin ui in a content type and I want to alter allowed value list and fill dynamically in form alter in drupal 7
1
vote
0answers
31 views

Does AJAX callback functions work differently for BEF views?

I am breaking my head since last two days to implement dependent drop down list. I have followed so many examples in the internet, SE and examples project but for some reason the simple thing isn't ...
1
vote
3answers
93 views

Redirect “edit” tab on single node view

I created custom node edit pages and I want the edit tab to redirect from node/2545/edit to topic/2545/edit or node/2549/edit to arts/2545/edit depending on the content type This is not an ...
0
votes
2answers
22 views

How to hook contact form of drupal 7 for custom styling?

how can I alter my contact form for adding custom classes I am using contact form of Drupal 7 core module.
0
votes
1answer
13 views

How can I get the english node title printed on the translated nodes edit page.

Something along the lines of this function THEME_AMENDS_form_alter(&$form, &$form_state, $form_id) { global $language; $lang = $language->language; $translations = ...
0
votes
2answers
45 views

why don't set the placeholder attribute for contact field?

this is my hook_form_alter function for set the placeholder attribute and other stuff: function mysubtheme_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case ...
0
votes
0answers
21 views

How to prefill multiple value autocomplete field when creating a node page using form alter

I am working on a todo content type that has "Assigned to" autocomplete field which is a multiple value field. I am able to assign one default user based on the third argument passed via URL ...
1
vote
0answers
23 views

Format inline drupal form elements

I got this: As you see I already aligned label and input field inline with CSS, because they are both inside same container, but the button is outside. I was wondering if I could somehow move the ...
0
votes
1answer
32 views

Views VBO: Set custom action with custom attributes selected in form

I have a view of persons. I like to add the persons to an event. I also like to set the status of the resulting relation to one of the values "optional" or "required". Therefore I use VBO on a list ...
0
votes
1answer
49 views

Preventing webform saving in database

Is there a way to prevent a webform submission to be saved in the database? I have added a custom submit handler to my webform but I don't want to save in the DB but send it to an external ...
0
votes
1answer
97 views

Maximum upload size for file is not working

I have set file filed with 25MB Maximum upload size. But when i upload more then 25mb file it is uploading. How to stop this.Can we create any custom module for file size.
0
votes
2answers
27 views

How to find out which form I want to alter

I am adding a functionality to drupal commerce kickstart, which involves product display modification. There should be a lot of forms but I don't which one to alter and add my new object to the ...
0
votes
0answers
37 views

Creating horizontal tabs in edit-form programmatically and moving fields to them

I am building a module which should create horizontal tabs in node-edit-forms and move existing fields into them. Creating the tabs works fine: function add_adminviews2forms_form_alter(&$form, ...
0
votes
1answer
49 views

Hook_Form_Alter Edit Existing Field Type

I am using hook_form_alter in template.php to add datepicker to a field on an exposed view filter. function MYTHEME_form_alter(&$form, &$form_state, $form_id) { if($form_id == ...
0
votes
1answer
20 views

Change User Profile Fields from modules - $form fields not available - Ubercart Roles

I have been attempting to change various fields on the user profile to make it more user friendly, most of it going well. However, when I try to access $form for the main user profile via dpm($form) ...
0
votes
1answer
21 views

How to modify the add node forms using hook_form_alter [closed]

This is the $form_id of a content type: q_a_node_form. I'm trying to change its add/content form (the title field) using hook_form_alter. this is my code in template.php: function ...
0
votes
1answer
54 views

How to hide profile2 field label and captcha label in registration form

I've tried using 2 different functions, where both successfully sets the value to 'invisible' with a dsm($form) check. However, the label is still being displayed. function ...
0
votes
1answer
35 views

How to put a link / menu at the top of the edit-user profile page? [closed]

How can I put a link / menu in the edit-user-profile page, in the upper right corner? This link will open a new page with a form created. I've been watching a few examples but I could not ...
0
votes
0answers
36 views

Alter create content form when logged in as admin

Can I alter the form where you add content (logged in as administrator, so in the overlay)? I know how I can alter the form when logged in as a user like this: function ...
0
votes
0answers
22 views

“An illegal choice has been detected. Please contact the site administrator.” When I try to submit the form this validation error is thrown [duplicate]

function user_form_edit_form_alter(&$form,&$form_state,&$form_id) { if ($form_id=="user_register_form") { ...
1
vote
2answers
56 views

Inserting a view in node edit form

In a node edit form i want to display an editable view, so an author can not only edit the node itself but also can alter some values of other nodes represented by the view, which is editable via the ...
0
votes
2answers
47 views

How do I can change the default description of Drupal 7 elements?

I'm trying to change the default descriptions in different pages like (add users). I tried devel themer to findout where there descriptions are came from but it showed nothing. for example look at ...
1
vote
2answers
46 views

How to add options to a select list of a content type?

I built a module that creates a form and let the user to add a variable called unit into database. Now this unit should be the options of select list of a content type. the form id of the content type ...
1
vote
1answer
92 views

Is it possible to define hook functions in template.php instead of the module?

Theme functions are defined in the template.php but is it possible to define hook functions in there? for example There is a content type called phone-book, its add content form ID is phone-book-node, ...
2
votes
2answers
42 views

Add subtitles to register form

I'm trying to add some titles in my registration form. This is a part of my registration form: But now I would like to have some titles like the following: I know that you can alter the ...