Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
106 views

Autocomplete field where title is replaced with NID

I'm using Drupal 7 and I have made autocomplete function to be called on a field. File my_module.module: <?php function my_module_menu() { $items = array(); $items['/...
Marko Basta's user avatar
0 votes
1 answer
111 views

Hiding group_group field programmatically

I am trying to hide the group_group (request membership) field for organic groups based on a radio button. Here is what I have done that doesn't work: /** * Implements hook_form_alter(). */ ...
staminna's user avatar
0 votes
1 answer
25 views

How to break up user roles checkboxes into groups?

When editing a user in Drupal 7 (/user/NID/edit), I'd like to break up the roles checkbox options. By default, it is just one list of roles. Instead, I would like to group different roles together to ...
Matt's user avatar
  • 37
1 vote
1 answer
212 views

How to programmatically disable Global Theme Settings?

I am trying to programmatically disable logo and site name. I have seen some variables for these set in modules/system/system.admin.inc but haven't been able to disable them through my profile ...
Shawn's user avatar
  • 437
-1 votes
1 answer
406 views

Include php file as contents of field #markup?

I've got a form with a #markup element and I'm trying to use a php file as the contents of the markup. The following is printing a 1 where the markup should goes, and printing the contents of the file ...
Mrweiner's user avatar
  • 1,961
1 vote
1 answer
83 views

Render a form from an existing module

We are just trying to gain a deeper understanding of Drupal forms and how to manipulate and render them as needed. We have a module installed which allows uses to edit and create content through a ...
CleanCode's user avatar
0 votes
1 answer
198 views

How can I show only webform content by excluding header,footer?

I wan to show only the form elements in an modal(popup), but am not able to achieve that. Along with the form elements header, footer is also showing. So how can I remove those things for specific ...
Suraj's user avatar
  • 884
0 votes
1 answer
86 views

How do I a use a template file to theme a mulit-step form?

I am creating a multi step form, and displaying that through a template file. The first step of the form displays fine, but when I go to the second step, the first step titles are also displaying. ...
Suraj's user avatar
  • 884
0 votes
1 answer
483 views

How to pass theme variables in #theme in a form element?

I need to pass product variable defined in hook_theme() and invoked in #theme but not sure how to pass product variables in #theme Please suggest. function storeinv_theme() { return array( ...
harshal's user avatar
  • 4,354
0 votes
1 answer
136 views

Let users create content by using the default (non-admin) theme

sorry to ask a more conceptual question but I am really stuck. I have a Drupal 7 site where users will sign in and then create a certain kind of content. I have the content set up ready to go. Do I ...
100pic's user avatar
  • 1,287
1 vote
1 answer
28 views

What's the best way to add a form in a node template?

I already have a node created with some custom fields, I would like to show a specific form in the detail page of the node that i created (using the node.tpl.php file) Why? because I need to use some ...
xstean's user avatar
  • 429
0 votes
1 answer
853 views

How can I remove an action link?

I have a form that I'm creating and I'd like to get rid of the 'Add contract' button that is being put there automatically. Is there something different I can do here: function my_module_theme($...
spuppett's user avatar
  • 187
1 vote
1 answer
707 views

Add ctools processing for content loaded via ajax

I have a search result page where all the searched results are loaded using ajax call. For each result, there is a button which should open a form in the modal. The code snippet which is loading a ...
Rahul Shelke's user avatar
0 votes
1 answer
58 views

How to make a form with latest nodes listing with checkboxes same as in 'admin/content' page?

I want to create a custom module for newsletter composer in drupal 7. To create a newsletter I need to show latest 100 nodes in a form with a checkbox and a dropdown (Select box) to select the section ...
Puneet's user avatar
  • 133
0 votes
1 answer
768 views

Bootstrap horizontal form layout

In Bootstrap there is a nice horizontal form option. But in Drupal + Bootstrap base theme I couldn't find any ways to use this horizontal forms and layout form elements as it described, eg. col-2 for ...
Timophey Popov's user avatar
0 votes
3 answers
6k views

"cannot use a scalar value as an array" warning for adding #prefix and #suffix in template.php via hook-form-alter – Drupal 7

I have the following code in my Drupal’s template.php file. What it does is to embed every element of my site's contact form (created with the Webform module) in a li element (the form itself is ...
SimilarToACoolPerson's user avatar
0 votes
2 answers
294 views

Form in custom template does not submit data

I have a custom form which I render in a custom template. I render the elements separately but the submit button does not fire the data to the validation/submit function. When I render the whole form ...
FeBe's user avatar
  • 303
1 vote
1 answer
2k views

Render a custom form in a custom template

For my site, I have to create a custom form in a custom template. It is not in a custom block, but in a custom tpl-file. I have searched the internet for a solution, but or the form is not shown or ...
Carlo Van den Bunder's user avatar
2 votes
0 answers
403 views

Globally increase #maxlength attribute of textfield (form api)

I have thousabds of field for admin to edit data which is saved in db from mobile app. i can fetch those data into text field while editing but drupal having default #maxlength of 128 character but in ...
Mukesh Gami's user avatar
2 votes
1 answer
452 views

Custom template for each profile2 profile type edit form

I am working on a Drupal 7 site and for a few days now, I've been struggling with this problem: I am trying to create a custom template for the edit profile form, but there are more profile types. I ...
Stavovei Ciprian's user avatar
2 votes
2 answers
84 views

Add attribute to all textboxes in the site

The question is simple , in my theme I want to apply an attribute to all textboxes in whole forms . I know how to add an attribute to an specific element in drupal using hook_form_alter , but it is ...
Alireza Tabatabaeian's user avatar
1 vote
1 answer
900 views

Using Bootstrap theme and anonymous user, ajax form submit results in "call to undefined function bootstrap_form_process"

Context We have a subtheme based on the Bootstrap theme and we're rendering a form inside of a modal. The submit button uses an ajax callback to handle form submission. Problem When logged in as an ...
ssteigen's user avatar
1 vote
1 answer
901 views

Put form labels left of the fields?

This is an age-old debate in Drupal, and I am surprised this has not been asked before on Drupal Answers. Maybe I missed it. By default, Drupal form labels are always displayed at the top of form ...
donquixote's user avatar
  • 3,662
-1 votes
1 answer
734 views

How to join my custom table data to a node using nid

My module implements a custom content type, let's say Magazines. This content type will have just title and tags field in order to use taxonomy from Drupal. I have a custom table custom_magazines ...
joaoclobocar's user avatar
0 votes
1 answer
251 views

Open preview in new window/page

I'm using drupal 7. Normally, during the creation of a contents, the preview is added above the form. I would wish that the preview opens in a new window, and that it is separated from the form of ...
Fluidouix's user avatar
  • 101
-1 votes
1 answer
30 views

Added Classes showed in dpm but don't show up in the output HTML [closed]

I want to add some classes into my form (node/add/-- form) so I use hook_form_FORM_ID_alter but I don't know why the classes add to my field in the dpm() output but when I check the html output those ...
Mohammad Yousefi's user avatar
1 vote
1 answer
516 views

How to wrap / manipulate element outputs on a form's checkboxes html?

I have the following form that contains a big list of checkboxes. The first checkbox is the parent of the children below it. In my case it is called "Africa" and the ones below it are "Africa-child" ...
Patoshi パトシ's user avatar
3 votes
2 answers
410 views

How to render the same field twice but with different name/id attribute?

I have overriden user-register.tpl.php and in it I would like to render same checkbox twice (so that I can submit if either of them have been checked and they are the same I just need to display them ...
MePo's user avatar
  • 167
0 votes
0 answers
43 views

How to theme or override forms when using Panels

I am using Panels in my website. there is a page user/$username/edit which enables the people to edit their profile. I tried the following code to theme the user_profile_form form. Template.php ...
M a m a D's user avatar
  • 3,837
0 votes
2 answers
750 views

I can't render default values on form element in theme_table()

For the last few days and some of last week I've been trying to fix up the interface of a page we have on one of our modules since it was difficult to use. I decided to take this data and just display ...
Chad Payne's user avatar
0 votes
1 answer
44 views

In a managed_file upload field, how do I prevent an overflow with long file names?

I have a form using the field type of managed_upload. Things are working fine accept when the file name is long. Given the snippet of code, below. Might there be a way to override CSS or inject any ...
Rick's user avatar
  • 2,984
0 votes
0 answers
24 views

Share webservice output between tpl

I have a specific tpl being defined within the theme and the specific view function contains a function that calls the webservice. It saves it within the items array which then outputs as variables ...
jagmitg's user avatar
  • 161
0 votes
1 answer
40 views

Static form to print on TPL

I have created a module i can use to create multiple blocks, now with one of those blocks, there is a requirement for a form (which the user needs to be able to see). However, this does not require ...
jagmitg's user avatar
  • 161
1 vote
1 answer
112 views

Theme specific form field for custom content type

I have created a custom content type and added some fields to it. I want to theme one of the fields which I added from the "Manage Fields" section. I want to remove the div wrappers when the form ...
Villie's user avatar
  • 311
0 votes
1 answer
108 views

How to theme the node edit form to group fields into collapsible containers?

I'd like to tidy up an unwieldy node edit form using collapsible fieldset elements. I can do this by implementing a form_alter hook but will this affect Drupal/other modules' ability to process/...
artfulrobot's user avatar
  • 4,059
1 vote
2 answers
196 views

How to reduce HTML output on Drupal forms

How to let Drupal print only necessary HTML in forms. I want to override fields input. This is the current code for node add form: <form ...> ... <div class="field-type-text field-name-...
Jasom Dotnet's user avatar
0 votes
1 answer
160 views

Remove all Div wrapper from comment form

I want to strip all default Drupal form wrappers and have something like below in comment form output <form> <input type="text" name="name" ...
Yuseferi's user avatar
  • 22.2k
0 votes
2 answers
428 views

Show a Particular Page in Drupal 7 Table Pager

I have a table and a table pager in my form. // $table_rows is an array containing data. $page = 2; //$page indicates that I want to display the second page in the table pager //$page is dynamic. ...
user avatar
1 vote
1 answer
551 views

Template for custom form not working

I am trying to theme a custom using a template file but unfortunately I am not getting it by using the below method. listing.module function listing_menu() { $items['ad-listing'] = array( 'page ...
Ashkar A.Rahman's user avatar
1 vote
1 answer
1k views

Drupal 7 Query database and display results same page in custom module template

I want to see the results on the same scree after submit. But my results php error: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /var/www/html/...
hide's user avatar
  • 21
1 vote
0 answers
86 views

Managed_file images disappearing after form resubmission

I'm building a site using the Nexus theme, and wanted to give users the ability to change the slideshow images using Drupal rather than using the default FTP (which is an odd way to make people update ...
Kevin Cull's user avatar
0 votes
1 answer
23 views

How can I remove the descriptions from the registration page programatically?

Using the custom module mentioned here https://www.drupal.org/node/754542#comment-2775706 I was able to remove the descriptions from the user login page. function alterlogin_form_user_login_alter(&...
Marty Jannetty's user avatar
3 votes
1 answer
1k views

Using hook_form_alter on an existing form element

I'm using the Commerce module and in the checkout process I'd like to change the size of one of the input fields. I'm trying to use the following code but it doesn't seem to be working. Am I doing ...
Sage's user avatar
  • 2,463
2 votes
1 answer
115 views

Display term description below a field widget based on the selected option on node edit form

I am trying to show a block (or the term description) on the node edit form when a user selects the term. An example: User is creating a node with a "location" vocabulary. They select their state (...
Brandon's user avatar
  • 193
0 votes
2 answers
119 views

My battle with drupal's form

In the ancient times when things were easy, you just had to code a form in html and then your php would typically have a if($_REQUEST['some_value']) to handle the request. But now with Drupal, nothing ...
Guillaume Bois's user avatar
0 votes
1 answer
34 views

Using Theme() to output html/javascript in user edit

I have a module that outputs a button to the user edit page. I use the form_user_profile_form_alter to append the button but I want to add html and javascript after it. I saw that the theme() function ...
Amy's user avatar
  • 5,803
0 votes
0 answers
25 views

How to process form in template when you aren't printing the entire form

I have a form where I am only printing out certain parts of it because I want to style around them. i.e. <?php print drupal_render($variables['form']['field_city']); ?> However, when I try to ...
Jack Ryan's user avatar
  • 2,307
0 votes
2 answers
781 views

Drupal 7 - create own login form

Is it possible to create own login form? I need to insert it into my basic page. It is campaign for my client and he wants to be able login from specific basic page. I have tried to use block from ...
Dawe's user avatar
  • 193
0 votes
1 answer
1k views

How to do autocomplete in a Bootstrap modal form?

I've got a D7 page that constructs a Twitter Bootstrap modal form; it appears in response to a click on a button on the page. I'd like to have in that form a textfield that uses the standard Drupal ...
Jim Miller's user avatar
  • 1,948
1 vote
0 answers
76 views

context condition for field group multipage

I have a node form configured with field group multi page, my node form is outputted as a block on the front page. I want to disable(hide) the rest of my front page blocks when the user is on the ...
ducu's user avatar
  • 11