Questions tagged [forms]

Use it for questions about the Form API. Don't use it for entity or entity field forms.

Filter by
Sorted by
Tagged with
0 votes
1 answer
5k views

jQuery UI Dialog attempt to submit a form using AJAX redirects me to the actual form page instead of AJAX submitting

I have a form and I want to do the following Click a link to popup a modal JqueryUI Dialog window Load into this window, via AJAX, a Form Submit the form via AJAX Upon successful submission, Close ...
user6381's user avatar
3 votes
2 answers
7k views

prevent redirect after form submit?

I'm using drupal's form API as part of a block in my module. When the form is submitted, I want to change the content of the block to something else, let's say "Thanks". I do not want the page to ...
artfulrobot's user avatar
  • 4,009
1 vote
1 answer
2k views

hook_theme not being called in module

I'm working on a module that has a custom output for the form that's being called, and this form has multiple pages. The multiple page part is being called correctly, but I can't get the theme to ...
dragonmantank's user avatar
2 votes
1 answer
71 views

Node form – self changing theme

I'm adding different way of node editing so I have this code in my module: $items['node/%node/edit-full'] = array( 'title' => 'Full edit', 'page callback' => 'node_page_edit', 'page arguments' =...
wtk's user avatar
  • 604
1 vote
2 answers
3k views

Easily theming Form Fields - How to get minimum HTML required for form field in Drupal 7

I'm using my own templates to modify forms, i.e. user registration form. In my custom template, I call drupal_render($form['field_email']); to get output for a text input used for taking user's Email. ...
Shafiul's user avatar
  • 1,226
2 votes
3 answers
1k views

How do I programmatically retrieve the inputs from a form?

I am implementing a hook_form_alter in my custom module and I want to get all the inputs from the $form variable. So, if for example there is a textarea, a radio button and a checkbox, I want to grab ...
user avatar
1 vote
1 answer
2k views

How do you use forms to populate content type fields?

Drupal 7. Custom module. I have a content type 'RFI' with a handful of fields I created with Drupal UI. I want a user to: fill out a form & click submit while drupal: saves fields to database, ...
Jerrud's user avatar
  • 81
0 votes
2 answers
552 views

render full form

I need to render a full form, including the <form>....</form> tags. Any ideas how can I do that? I tried drupal_render() and render(). The form elements are rendered but there is no <...
Marius Ilie's user avatar
  • 3,072
2 votes
2 answers
3k views

How to apply a theme function/template to my form

I think theme_form() is responsible for rendering forms! I want to change the look of a form, a lot. I think just instead of theme_form I can use my custom theme function/template file. I can use ...
Shafiul's user avatar
  • 1,226
6 votes
2 answers
3k views

$form['redirect'] = "something=$someId"; doesn't work in Drupal 7

I am here again with a problem! I want to make a form redirect usign a url with ids and somethings else as parameter, but when the code is executed something encode my url, so, if I put something like ...
Andres Grosso's user avatar
2 votes
1 answer
695 views

Ajax form - Multiple select elements

I have a form with multiple select elements with an #ajax callback on change. The ajax is working but the problem is that I can't figure out how to find which select has triggered the ajax. All ajax ...
Marius Ilie's user avatar
  • 3,072
2 votes
1 answer
351 views

Where is $form_state stored between form build, and form submit functions?

I assume that $form_state data can normally be stored either in the database, or in the session. In this code: function _module_name_main_form($form, $form_state) { $form_state['random_extra_data']...
Letharion's user avatar
  • 27.5k
0 votes
1 answer
1k views

Saving form after altering it

I'm altering the "Edit menu link" form function module_name_form_menu_edit_item_alter(&$form, &$form_state, $form_id) { $form['html_content'] = array( '#type' => 'textarea', ...
Omar Abid's user avatar
  • 115
1 vote
1 answer
2k views

Hide create new account tab

How to hide Create new account and Request new password tabs in user login form? I use Drupal 7. I use custom theme. Maybe in template.php file some function? You can see my page - http://broceni....
Martins's user avatar
  • 31
1 vote
0 answers
129 views

Display Comment Wrapper for Anonymous users

I would like to display comment-wrapper.tpl on a node to anonymous users, even though they have to login to comment and even when there are 0 comments on the node. Ideally it would display the wrapper ...
DrupalNewbie's user avatar
4 votes
1 answer
3k views

form error Fatal error: Cannot use string offset as an array

It's pretty stright forward, im trying to display the results of my form, Im having trouble finding something that explains how to display the results outside of the drupal_set_message() code, I ...
Jeremy Love's user avatar
6 votes
5 answers
3k views

Permissions Administration Module

Is there a working module for Drupal 7 to restyle admin/people/permissions/list to add more usable controls? Some serious boons to building a large site with lots of permissions: Incremental search/...
Alexios's user avatar
  • 163
1 vote
1 answer
202 views

Text format dropdown has dissapeared from edit article form

There is something strange it happened at a certain time. I no longer can set the text format from article (node) edit because the Text format input has dissapeared. I can configure them from ...
drupal_stuff_alter's user avatar
2 votes
1 answer
2k views

Add markup to form during validation

I have a custom validator on a webform. When a person enters an address, I validate it. When the address is not right, I set an error in the validation function. This is all going well. But now I want ...
Nealv's user avatar
  • 236
1 vote
1 answer
1k views

Alter the menu_edit_item form

I'm trying the alter the menu_edit_item (Edit menu link in a menu element) with a module. So far I tried function module_name_form_menu_edit_item_alter(&$form, &$form_state, $form_id) { ...
Omar Abid's user avatar
  • 115
3 votes
1 answer
1k views

save the value of a custom form in the database

Why isn't the code saving values in the database? module_load_include('inc', 'firstform', 'firstform_node_form_alter'); function firstform_menu() { $items = array(); $items['submit_driven_ajax'] = ...
Mohamed Ibrahim's user avatar
0 votes
1 answer
355 views

Processing forms together for a tree of related entities

I have EntityA which has one or more EntityB's which have one or more EntityC's. EntityB references values of EntityA and EntityC references values of EntityB. My current plan is to have an id field ...
Joe Beuckman's user avatar
  • 1,101
4 votes
4 answers
4k views

Prevent ajax submit function being called when it fails validation

I have a form, that when it's submitted, should be validated, and if valid, the results of that form should then appear below the form. This works fine without AJAX: function _form_validate($form, &...
Apemantus's user avatar
  • 567
1 vote
1 answer
170 views

Form timing out with drupal_set_message

I am getting some type of timing out error and not sure how to fix it or even where to begin, the error looks something like this http://pastebin.com/M8Wz4KEY /** * Block info */ function ...
Jeremy Love's user avatar
4 votes
4 answers
5k views

Adding AJAX to existing node form

Creation of new content type by D7 core is intuitive, fast and nice looking. We don't have to worry about db tables and simple validation. We have widgets, displays, etc. And actually we are building ...
Gregory Zbinsky's user avatar
3 votes
3 answers
5k views

What's the best way to create a booking form?

I need to create a booking form for an event. This form will contain normal text field plus one drop down list with the number of tickets. There will be a prefilled field with the price of the single ...
Tyler Durden's user avatar
  • 2,316
0 votes
1 answer
143 views

Why this callback doesn't show all node form?

This question is related to: Custom module embedding existing node form After dealing with returning existing node form via custom module (my_singnup module achieved with the big help of Clive) ...
Gregory Zbinsky's user avatar
3 votes
2 answers
936 views

Best way to break up node edit forms smaller, more manageable forms?

It's pretty common to end up with massive node edit forms once content types start accumulating fields. Collapsable fieldsets and vertical tabs help the UI, but it can still be overwhelming. Example: ...
milesw's user avatar
  • 433
0 votes
2 answers
842 views

form submission not working

I am just starting out making my module and already running into 2 problems, I believe this is being cause because the form is in a block but I am not entirely sure. This is what I have in my .module ...
Jeremy Love's user avatar
2 votes
1 answer
1k views

Custom module embedding existing node form

I have the following content types: event signup I'm dealing with my_singnup module, for which I wish to: allow user to add signup content (same as core node/add/signup) using signup/event/%...
Gregory Zbinsky's user avatar
10 votes
3 answers
21k views

Image Upload in a Custom Module

I'm writing a custom module, and I need it to upload an image. I'm having trouble finding good documentation on this, but I think I'm close. What am I missing? $file returns false in the form ...
Tim's user avatar
  • 203
0 votes
2 answers
870 views

How do you handle static HTML forms saved in a "Basic Page" in Drupal 7?

I am a Drupal newbie and have been asked to help with some issues on a Drupal implementation. I have been asked to handle HTML forms that have already been designed and saved in "Basic Page" as either ...
user6174's user avatar
0 votes
1 answer
492 views

How can I theme profile field forms in an HTML table?

I put this code in Drupal 6, and made a template file called "user-register.tpl.php" to override the default registration page. function my_theme_theme(){ return array( 'user_register' => ...
chinita7's user avatar
  • 1,021
1 vote
1 answer
1k views

Issue with Mac OS and AJAX in Forms

I'm working on a custom field type module for a Drupal 7 project and tried to make use of Drupal's AJAX framework in forms. For some reason not even the simplest AJAX requests work on my machine (...
Jakob W.'s user avatar
0 votes
2 answers
3k views

Has anyone implemented a tablesort with ajax? [closed]

I would like to sort on a column with a round trip but no page reload. The table is very large and has to be paged in, which I am doing manually with an ajax select element. I know TableSort is ...
Joe Beuckman's user avatar
  • 1,101
1 vote
1 answer
672 views

How to alter the result of my view using filters?

I have a view with 2 exposed filter.. I only want to change the result of my view when filters are used, ie if they have any value and press the button to run the filters. I try to used the ...
Dvex's user avatar
  • 343
2 votes
0 answers
802 views

Component returned failure code: 0x80460001 (NS_ERROR_CANNOT_CONVERT_DATA) [nsIDOMFormData.append]

We're building a drupal-site with an upload form. Not webform. When we click on the "insert image" button we get alerted with "Component returned failure code: 0x80460001 (...
Oscar Eriksen's user avatar
0 votes
1 answer
2k views

How to manage ajax in nested forms?

As implied in this question, I'm adding a list of similar child forms to my parent form with the following code: foreach ($form_state['items'] as $key => $item) { $existing = NULL; if (...
Joe Beuckman's user avatar
  • 1,101
13 votes
2 answers
10k views

Getting "The form has become outdated" error

I have a multistep node form. Half way through the form through a popup dialog user is asked to login if they have not logged in prior. Upon successful login when proceeding with next page of the ...
quest's user avatar
  • 141
0 votes
1 answer
116 views

Why should we avoid theming forms with template files?

The issue was raised in this question. Why not exploit the advantages that template files offer in the case of forms?
Joe Beuckman's user avatar
  • 1,101
1 vote
1 answer
780 views

How to handle ajax wrapper id for list of similar ajax forms?

Consider a Drupal 7 page with a list of same-type entity forms: formA, formB, formC. The entity form uses ajax to replace part of itself. Is there an established way to manage the wrapper id's so ...
Joe Beuckman's user avatar
  • 1,101
2 votes
2 answers
2k views

Example of entity-within-entity subform processing

Suppose that, in Drupal 7, EntityA includes one or more instances of EntityB. Is there an example of building the create/edit form for EntityA that includes one or more edit forms for EntityB, and ...
Joe Beuckman's user avatar
  • 1,101
0 votes
1 answer
39 views

Given a form, how do I find the fields present in them?

How do I get the list of fields present in a certain form, I know the form id, I just need the names of the fields present in that form ?
user avatar
0 votes
0 answers
352 views

How do I pass data from one form builder to another?

I have a page callback that does this: // ... $page['search'] = drupal_get_form('search_form'); // ... $page['list'] = drupal_get_form('list_form'); // ... return $page; The first form builds a ...
Hanno Fietz's user avatar
2 votes
2 answers
1k views

Need to force #default_value for AJAX tableselect checkboxes

I built a drop-down ajax pager that replaces a tableselect with the requested page of rows. The array of selected item IDs is stored in a hidden field and that logic is working across entity load/save ...
Joe Beuckman's user avatar
  • 1,101
1 vote
5 answers
6k views

ajax form submit multiple times

I have a form which consists of one submit button (Add to cart). I made it submit via AJAX but the problem is that when I press the button the second or third (and so on) times, the submit handler ...
Marius Ilie's user avatar
  • 3,072
0 votes
2 answers
581 views

Error in file_save()

I have a config page in my module were you can upload a file and change a few other settings. It works fine IF you do upload a new file when you click save however if you don't upload a file and just ...
Justin's user avatar
  • 91
2 votes
3 answers
959 views

Default value to drupal variable

I have a piece of code that I want to have the default value be a variable, but I need to know how to set a default value if the variable is not set: $form['background_audio_height'] = array( '#...
Justin's user avatar
  • 91
0 votes
2 answers
760 views

How do I get the $language object inside a form builder?

I have this necesity to use $language inside MY_MODULE_form($form, &$form_state) function and it seems is not available. I tried to define it as global, but it displays blank. global $...
drupal_stuff_alter's user avatar
0 votes
1 answer
96 views

Remembering the address of the calling page of a form (Drupal 7)

I have created a little module that implements hook_menu and when the menu item is selected it displays a form that is defined as so: function documentation_menu_nameform() { $form['documentation']...
Mike2012's user avatar
  • 1,761

1
123 124
125
126 127
137