Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [forms]

Don't use it for entity or entity field forms.

19
votes
3answers
18k views

Form Redirect not working if 'destination' is in URL

In one of my forms, I'm trying to set a $form_state['redirect'] so the form will go to that destination after the user clicks one of the action buttons. If I inspect $form_state['redirect'] both ...
26
votes
2answers
23k views

How do I set allowed extensions for a managed_file form field?

Not having any luck find this in Drupal documentation or developer examples. I need to set a managed_file form field to only allow zip files in a Drupal 7 custom module.
1
vote
2answers
1k views

How to hook to content profile edit form validation

I try the following code, but it doesn't seem to work. function mymod_profile_node_form_validate($node,&$form) { firep($form, 'form'); } Could anybody help?
3
votes
1answer
7k views

How to render a form in table layout

What is the Drupal way of presenting multi-row, multi-column module data to the user in Drupal 6? Nothing jumped out in the API documentation. I was googling for some answers, but they all applied to ...
9
votes
6answers
15k views

E-mail validation form api

What is the best way to handle server side e-mail validation in the form API? Can it be implemented somewhere inside part of the form described below or are there other options? $form['address']['...
3
votes
3answers
1k views

Secondary submit function for form input button

I want to have buttons for remove selected field from form. $form['questions']['buttons'][$counter] = array( '#type' => 'button', '#name' =>'button_'.$counter, '#...
4
votes
5answers
10k views

How to hide a fieldset

I am trying to use hook_form_alter() to change the way a form is displayed. The form has 4 fieldsets and I only want to display one of them. How can I make these fieldsets invisible using ...
2
votes
1answer
538 views

WYSIWYG error when using managed_file and AJAX

I have a form that has both a managed_file element and a text_format element. Both are encapsulated in a wrapper div (using #prefix and #suffix). On submit, an AJAX callback is executed and both ...
6
votes
2answers
333 views

Difficulties with the #ajax form item attribute

My form item is the following one: $form['foo'] = array( '#title' => t('Foo'), '#type' => 'radios', '#options' => $options, '#description' => t('Lorem ipsum.'), ...
1
vote
3answers
584 views

Show the value of a node-form field inside an AJAX field added via hook_form_alter()

I have created a simple content type "reservation" with an integer field called "field_km" with a default value of 50. On the node creation form, I want to have a markup field showing the value of the ...
5
votes
3answers
9k views

Simple confirmation popup dialog box

How is it possible to create simple confirmation popup dialog boxes in Drupal 7? I've searched a lot, but I found tons of non-working suggestions and code.
3
votes
3answers
124 views

How do I better play nice with weights, when overriding a form?

I'm attempting to use the Constant Contact module. One of the features of this module is that it inserts a check-box into the user registration form. The problem is that it seems to set weights in a ...
4
votes
1answer
650 views

How can I have multiple versions of the same form, in different pages?

There is a default Drupal 7 form called "user_profile_form". I would like to show certain elements of this form on one page of my website, and then a different set of elements from this same form on ...
2
votes
2answers
3k views

How do I call an implementation of hook_form_alter()?

I have a function in my module that implements hook_form_alter(): function getuserform_form_alter(&$form, $form_state, $form_id). How do I call it? How do I pass it the required parameters?
1
vote
1answer
60 views

dissecting the og module - where is the content type form submit handler for function og_ui_form_node_type_form_alter?

drupal version: 7 Hi, I'm trying to add settings to a content type form and I'm using organic groups as a guide. I see the form elements for OG being added in the og_ui.module at line 316 in this ...
0
votes
1answer
141 views

Passing an extra element to $edit array when creating an account

I added an extra user registration validation critera in my custom module by implementing hook_user if ('validate' == $op && 'user_register' == $edit['form_id'] && 'account' == $...
5
votes
4answers
7k views

Reset node form after AJAX submit

I have a node form in a block, that is submitted using AJAX. I've created my own callback, because I'm adding the created node to the page if the submission was successful. Now, I want to reset the ...
0
votes
1answer
878 views

Run javascript code on Form Submit

I want to run JavaScript code upon a form being submitted preceding other default tasks that are carried out on form submission. May anyone suggest some approaches?
39
votes
1answer
18k views

Managed file: the file used in the field may not be referenced

I am having some issues with the managed_file type. Whenever I try to edit and save a form that has a managed_file element in it an error occurs: The file used in the Picture field may not be ...
1
vote
1answer
980 views

process form in popup window

I have a custom module in Drupal and I also have a custom table for storing the details of seminars, such as name, description, date and location. I am showing the names of the seminars in a left ...
1
vote
2answers
391 views

Send variable to the user profile in Drupal 6

I am developing a module for Drupal which provides a login form and after submission user cURL to login in with those credentials on another website. If all goes well, the module redirects the user ...
0
votes
1answer
549 views

Detection of form refresh and callback!

How is it possible to detect if the page, in which the form is, is refreshed and to detect if only the form is refreshed? I tell you the whole thing: I'm building a module. The form in this module ...
0
votes
1answer
585 views

How do I modify the content of a select list field?

I have a content type with a Node Reference field, so the user can select from a list of node titles. I need to filter out some nodes from the list (those that have a date field older than the current ...
4
votes
1answer
3k views

How to display messages from a block separately from $messages in page.tpl.php

I have a webform which works as a newsletter subscription form: it displays a textfield for an email and a button. When the button is clicked, a notification message is displayed on top of the page ...
1
vote
1answer
758 views

Form API: Show/Hide/Select option based on a previous option [duplicate]

Possible Duplicate: Easiest method for conditional fields in a form Essentially I have 2 select fields on a form: EDIT: I should mention, this is an entirely custom form built with Form API, I'm ...
3
votes
2answers
575 views

Multistep CCK module

I was working with the Multistep module. While working with this module I found that it creates a node of the corresponding CCK after the first step itself and then keeps editing the node. Is there ...
3
votes
1answer
5k views

How to display specific forms in drupal 7?

I need to display the system login form and the system registration form on the same page but different panels (not tabbed like the default). I don't want to build a form from scratch using the forms ...
0
votes
2answers
117 views

Administrator users can add records, end users can view them

How can the administrator users add few records into the database (through a form), and how can the end users view them in the front end? Administrator users will be adding records of training ...
0
votes
1answer
890 views

Create Forms in Drupal and process them

i am new to Drupal and i want to implement training / seminar program in my Drupal site. I want to know how to implement the following features: The administrator will be creating a seminar / ...
2
votes
2answers
1k views

Tracking user contact form submissions

How can I track user contact form submissions on Drupal 6? I'm thinking of something similar to the webform results table but for user contact forms. If not something that complex, then just simple ...
3
votes
1answer
917 views

Add CCK form with overlay or colorbox

I have a CCK form. When users submit the form, and add new content, I would like the form to be viewed in an overlay that allows the form to use all of the browser window's area in a similar manner as ...
0
votes
1answer
728 views

Ideas on how to create a multi-part form, where the form requires completion/approval by another user

Desired form submission workflow: User A fills out a form, along with an email address for User B User A submits the form, which then notifies User B by email of a request to complete and approve the ...
0
votes
1answer
249 views

Use form in the content type [closed]

who use a form in a node? for example I want to create a content type that show in this, my product , description , .... and bottom on this node have a form to get comment and price recommended of ...
5
votes
4answers
7k views

Form element #default_value and AJAX

I can't get a form to display a (default?) value after an AJAX call. I am using the following code: function foo_form ($form, &$form_state, $foo) { $form['#prefix'] = '<div id="foo-form-...
1
vote
4answers
2k views

How do I print the node add form in block.tpl.php?

I am using Microblog. How do I print the node add form in a block? I tried node_add('microblog'), but it doesn't work for me; then, I tried drupal_get_form('microblog_node_form'), but I am still ...
3
votes
2answers
7k views

How do I add classes to form elements in the theme layer?

I want to do it in template.php. The form ID is page_node_form, and there are six form text fields. The default class is "form-text." I want to add "text1," "text2," etc after "form-text" to each ...
1
vote
1answer
157 views

Dates to effect dynamic form behavior

I want a form to display an error if someone is not 18 years old, or display the next form item if they are. After exhausting a lot of time searching for a way to do it, I believe AJAX does not work ...
11
votes
5answers
4k views

How do I remove the revision information from a node edit form?

I'm hoping someone can help a Drupal beginner removing a view from my page. The purpose of it is a for data collection. This is the section I am trying to remove:
0
votes
2answers
2k views

How do I add a form to the block?

I want to add a configuration form for a block. The form's style is the following: one year (label) input text box value eg:$10 two years input text box value ...
4
votes
3answers
6k views

Ajax form that changes a button value

When a user pushes a button element marked with ajax, I would like the callback to modify the button value (text shown on button), and have it updated both in the browser and the form state. Updating ...
2
votes
1answer
870 views

How to make a form on the backend?

I want to create a form for the backend in Drupal 7, something like the following: label 1 text box label 2 text box label 3 text box label4 image image I then invoke the form output in ...
0
votes
1answer
4k views

Error using form API on AJAX submit

I am writing a form using the Drupal 7 form API. On submitting the form (via AJAX), the following error is displayed: An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information ...
2
votes
1answer
623 views

Updating a field value in database via submit handler doesn't update the user profile in UI

I've created the field "Attending" that is attached to the user profile. I have created a form with one checkbox element; when submitted, I've confirmed that the attending_fielddatabase is being ...
19
votes
3answers
15k views

Embed a “node add” form in a page

I'm looking for a way to embed a "node add" form on a landing page. I was using Form Block, but it appears to bring many error because I was using a development snapshot version.
1
vote
2answers
263 views

How to expose individual form elements from user-register-form

So I have a work flow/use case as such: an administrator user creates a user account, associating it to the "guest" role the guest users receive a login link once they log in, I want them to provide ...
0
votes
2answers
3k views

How to overwrite the add content page

I created a content type "test", and I want to overwrite the add "test" content page (http://www.example.com/node/add/test); for example, I want to show something on the right part of the page. How ...
1
vote
2answers
511 views

How to tell the difference between multiple image_buttons on the same form?

Using FormAPI to create a simple set of three image_buttons, in the form_submit handler there is no 'op' value set in $form_state and therefore no way to tell which image_button was clicked. Is this a ...
7
votes
2answers
2k views

(Un-) formatting each form element

When we declare something like $form['textfield'] = array( '#type' => 'textfield', '#title' => 'textfield title', '#maxlength' => 8, '#required' => true, ); The output will be ...
1
vote
1answer
442 views

Form, populate select lists values after unsuccessfull validation

I would like to have select values in my select lists that user poster to script. However when validation is not valid, those fields aren't populated with posted data, so user have to make the choice ...
0
votes
2answers
959 views

Form API select list remove blank entry (default select an entry)

I populate an select list using the following code. $getCompanies = 'SELECT nid, title FROM node where type = "my_type"'; $companiesResult = db_query($getCompanies); $companyArray = ...