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

How to add a “help tips” link next to the search button? [on hold]

0 down vote favorite I like to add a "help tips" link next to the search button. I made some changes on the "search-block-form.tpl.php" (see below) but it does not show on the search result page. ...
0
votes
0answers
13 views

multi step form drupal 7 [duplicate]

How can I create multi step form in Drupal 7? function module_template_menu(){ $items = array(); $items['them-noi-dung'] = array( 'title' => t('Khai báo hóa chất'), 'page ...
1
vote
2answers
13 views

How to hide fieldgroup Items in form alter

I know how I can hide any field in hook_form_alter,but I want to hide all items of field group in hook_form_alter I try function modname_form_alter(&$form, $form_state, $form_id) { switch ...
0
votes
1answer
11 views

Simplenews - how pass values from own input

How I can pass value from added input to database(?) in Simplenews? I want to use this value later in newsletter, e.g. print it in block template. Below is how I created field function ...
0
votes
1answer
16 views

Use hook form alter to change input type

I am trying to change the input type on an ubercart checkout form using hook_form_alter. I added an extra field using the uc cart extra fields pane module but there is no option to add e-mail - only ...
1
vote
1answer
23 views

How to use form field only once

I'm looking for solution for following scenario in my D7 site. I have form with 2 empty text fields. If user enters value in field 1 and submits form next time when he opens this form only field 2 ...
0
votes
0answers
7 views

Multilingual field in form_alter

I have a form_alter that needs to act upon multilingual fields. In order to have the fields load with proper language I do this at top of the form_alter: global $language; But then, in the fields ...
1
vote
1answer
23 views

Group entity reference field by a field on those entities

I have a content type of Location that has a list (text) field with options for Full Service or Quick Stop. On another content type, I have an entity reference field that pulls in all the locations ...
0
votes
1answer
33 views

Setting #title or #description in node_form_alter

I have have a field of type container that is acting as a title field, see complete definintion below. My issue is that I cannot seem to modify the title or description via form_alter, I have tried ...
0
votes
0answers
26 views

VIews Exposed Filter - custom query on date field

I have a content type with a date field. I further have a view with an exposed filter for this date field. In the view I don't want to filter for a specific date range but for any or no value set. ...
1
vote
1answer
45 views

How can I make form_alter work with Ajax Comments?

I did some manipulation (with JavaScript and CSS) on my comment form. It works good. Then I needed to install the Ajax Comments module because I don't want visitors to go another page while replying a ...
0
votes
0answers
26 views

How to remove readonly attribute from form input element

I have a form with date picker. Its a view exposed search form. i need to remove readonly attribute of this field to edit the field. I tried jQuery code ...
0
votes
1answer
62 views

Synchronous XMLHttpRequest on the main thread is deprecated error at the end of ajax call

I'm a developer on a freelancing site (the only one actually) and I'm trying to allow anonymous users to bid on a project too. For this reason, I have the following code to check whether the username ...
0
votes
0answers
50 views

Ajax on node add/edit form causes missing values on submission

I'm using my theme's form_alter function to ajaxify a select dropdown field on my node add/edit form. When the ajax is triggered, my callback function enables/disables other elements on the form and ...
0
votes
1answer
25 views

My form validate function will not run.

I am using Organic Groups. That module has a form where you add new members to a group. I would like to run additional validation on that form. I use hook_form_alter and can identify the form. I add a ...
0
votes
1answer
20 views

How to prepopulate a term reference field with multiple values on a new form?

I seem to struggle with a problem which has already been answered. I have a 'review' form on which there is a field that I want to prepopulate. It is a term reference field and I want it to be ...
2
votes
2answers
40 views

Omega template.php form alter

I'm trying to edit default user login block. I successfully changed it by creating custom block--user--login.tpl.php inside omega-starter/templates, but I don't want to write whole block code. I only ...
0
votes
2answers
12 views

Add html5 placeholders to node_add inputs

I'd like to add placeholders to node_add field inputs. I'm trying to use dpm($form) but am not sure where to put it. I couldn't get node-add.tpl to work with this function MYTHEME_theme() { ...
0
votes
1answer
39 views

How to redirect my content type form after submitting in module

How to redirect my content type form after submitting in module. Code: function message_proposal_form_alter( & $form, & $form_state, $form_id) { if ($form['#id'] == "article-node-form") { ...
0
votes
3answers
61 views

How to send hidden field value to db on webform submit

I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does ...
0
votes
0answers
11 views

Add a new country to location module in drupal 6

I need to add a new country to location module country list. I do not want to do it by changing in database. I can see there is a hook for the same in D7. <?php function ...
2
votes
1answer
42 views

hook_form_alter based on path

I don't know if this is possible but could I do something like <?php $foo = current_path(); print $foo; ?> in page--foo.tpl, then something like function ...
0
votes
0answers
31 views

How to change event registration(attendance) form in hook_function()

I am working on event page with registration (attendance) form with drupal commons. How to change custom function for that attendance form in event page. My requirement is when user will need to ...
0
votes
1answer
28 views

How to rearrange user register form and still pass validation

I've implemented a hook_form_alter to change order of fields on user registration form. i've moved mail and username fields inside a fieldset. on submit, drupal is returning an error of undefined mail ...
0
votes
0answers
3 views

Get $form_state backup and migrate filter extended class

I have form altered the backup and migrate quick backup screen (admin/config/system/backup_migrate) and added a text field. I'd like to use the value of the field to create a new node just before the ...
-1
votes
1answer
13 views

Hide zip in addressfield form on commerce checkout pane?

How can I hide some fields from addressfield module (for example zip code) on checkout process if certain country is selected? E.G. If US country selected then hide postal code field. If CA country ...
0
votes
1answer
27 views

Move timezone field in user/%/edit field

I want to move timezone field in user/%/edit form. I have used$form['#weight'] in hook_form_alter() and $page['#weight'] in hook_page_alter(), but not working.
0
votes
1answer
44 views

hook_form_alter function does not call the validate function drupal 7?

i'm creating a unique field module which restrict a user with specific role to create one node per year. it works first but after installing some modules Automatic Nodetitles, Cancel Button, Field ...
0
votes
1answer
25 views

hook_form_alter function does not call the validate function?

i'm creating a unique field module which restrict a user with specific role to create one node per year. it works first but after installing some modules Automatic Nodetitles, Cancel Button, Field ...
1
vote
1answer
38 views

How to redirecting add to cart form in drupal commerce programatically?

I just wants to redirect the add to cart form to a different page. After click on add to cart button i do not wants to go cart page. i just want to go thank you page. for that i am altering the form ...
0
votes
0answers
15 views

Changing field type to text_format via hook_form_formid_alter loses data when trying to edit form

I have a content type named "job posting." On this content type I have several long text fields, but I want to use a WYSIWYG on those fields, and I want to filter the WYSIWYG's HTML. Using ...
1
vote
0answers
84 views

Alter an existing form

We just starting out with Drupal 8 and very quickly we ran into our first problem. What is the best way to alter an existing form in Drupal 8? We need to alter the save method for the node form to ...
0
votes
0answers
26 views

Inline Entity Form - IEF - Hook Form Alter - Ordering

I've got a module that I'm developing (I'm admittedly new to module development) - where I'm appending a date to the IEF fields displayed. It looks like this so far. function ...
2
votes
1answer
24 views

How to store date_popup fileld in mysql

For some reason I cannot save the value of my date_popup field (comment_date) to mysql database. I need to use default value from existing field (field_due_date6) and store the new value to this ...
0
votes
1answer
43 views

Alter comment body in comment form [duplicate]

How can i alter comment body in Drupal 7 ? function sizin_form_comment_form_alter(&$form, &$form_state) { $form['author']['name']['#attributes']['placeholder'] = t( 'Name' ); ...
0
votes
3answers
66 views

PlaceHolder in comment Form

I want to add a placeholder to my all comment form , here is what i did : template.php function ThemeName_form_alter(&$form, &$form_state, $form_id) { if ($form_id == ...
0
votes
0answers
27 views

Node form alter place default value for select list

I have node form for Images content type which have a taxonomy term reference field. It is a select field with the options in it. Now I am trying to place a default value for the field by checking the ...
0
votes
1answer
18 views

hook_form_alter setting select list #options key allow attributes per option

I have a select list that I am populating $form['field_my_field']['und']['#options'] in a hook_form_alter. I was wondering what a good way to set a data attribute per each option would be. I've ...
0
votes
0answers
26 views

commerce_customer_profile_copy_refresh() ignores hook_form_alter() and renders default 'customer_profile_shipping' form

I'm having some issues with the commerce_customer_profile form on the first checkout pane of the Drupal Commerce checkout process. Specifically when the commerce_customer_profile_copy checkbox ...
0
votes
0answers
20 views

hook_form_alter() adding ajax event

I have a custom module that is adding a new field in the form in hook_form_alter(). In my hook_form_alter() I have function mymod_form_alter(&$form, &$form_state, $form_id) { ...
0
votes
0answers
32 views

Webform confirmation page with new information

I'm in the process of building a form to add new ServiceDesk requests. Below is the process. Create a webform Write a submit handler function to Create work order (according to ServiceDesk api, form ...
0
votes
0answers
43 views

Redirect to parent node after saving the field collection item

There is a field collection field for a content type, it is called field_item. I gave a direct link to the users to add content to this field based on the it's parent id. this is the url, ...
0
votes
3answers
221 views

#ajax form_set_error

I'm using the below code to query a webform field's value against database, and if the value exists, I want to use form_set_error, however I can't, since it requires rewriting the page. I have found ...
0
votes
0answers
21 views

Differentiating IDs inside duplicate blocks

I have a Webform as a block that renders twice on a page using multiple Contexts. The HTML form elements inside the blocks get rendered out with the same ID attribute. <form ...
2
votes
1answer
25 views

How to re-order user profile form?

I have this code: function mymod_form_user_profile_form_alter(&$form, &$form_state, $form_id) { $form['account']['#weight'] = 100; } Which is supposed to push the 'account' section of ...
0
votes
1answer
32 views

Inline Entity Form Order by field value

I'm attempting to sort the form table generated by IEF by the value of a specific field - but running into a stumbling block (in other words - it's not working). Has anyone else used the ...
0
votes
3answers
33 views

How to unset fieldset in hook_form_alter?

I want to unset a fieldset programmatically which is available in the content type. I tried to unset like this in hook_form_alter, unset($form['field_first_deposit']); But it doesn't work, where ...
0
votes
3answers
146 views

How to set default value for textfield programmatically in drupal 7?

I need a form_alter code or something that I could use to set my field value. I'm getting the value from the parameter and I've tried a lot of ways but nothing works for me. This is the list of codes ...
0
votes
0answers
41 views

Views - Unable to set custom form field value in Exposed form

I have a view with 2 exposed filters . one is the start date and the other is the end date. I need to programatically control the end date filter based on a checkbox. I added a checkbox to the exposed ...
0
votes
1answer
48 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 ...