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
2 votes
1 answer
966 views

How to call a Rules action settings form via drupal_get_form

So, I'm trying to embed the form I find at '/admin/config/workflow/rules/reaction/manage/commerce_payment_paypal_wps/edit/3' - which contains the settings for the PayPal business, etc (from ...
13 votes
3 answers
16k views

How do I add client-side form validation to a Drupal form?

How do I add client-side form validation to a Drupal form? For example, in the comment module. If the vistor don't enter the email address, I want to popup a window that says: "please enter the ...
  • 3,778
6 votes
2 answers
8k views

How do I resolve the "Argument 1 passed to drupal_attributes() must be an array" error on my system_settings_form()?

I don't usually post specific questions like this, and ask for help on a specific issue but I am at the end of my rope wasting time way... I have a simple D7 module as seen below, when I load the ...
  • 2,057
32 votes
13 answers
25k views

How can I disable a single checkbox in a 'checkboxes' FAPI element?

Title basically says it all, I want to disable a single checkbox of a checkboxes type FAPI element. I don't want to do if with JavaScript, nor is changing it from checkboxes to multiple checkbox ...
  • 3,692
3 votes
2 answers
2k views

How to expand the fieldsets in node-add form?

When I am adding new node by admin/content/node-type/story, there are a lot of settings ordered by groups: Submission form settings, workflow setting, comment settings. But all these fieldsets are ...
user avatar
3 votes
2 answers
669 views

How to output form element values as text?

On a node edit form, I want to make certain fields be non-editable by all users but the values stored in them to be visible on the form. My thought was to just print them out as text instead of in an ...
  • 5,534
8 votes
3 answers
3k views

How can I hook into the system Contact form Message Sent process and alter the HTML generated?

I have a Drupal site where I am using the sited-wide system Contact to allow visitors to send messages to the site owner. Once a visitor submits the form, the user is redirected to the home page and ...
  • 183
6 votes
2 answers
2k views

How should I handle container form elements?

I have added some custom fields to the register user form and I'm discovered that they are sent back, packaged in a form element of type "container". My code needs to handle all kind of different ...
  • 355
3 votes
1 answer
1k views

Node form redirect based on submit button value

I've read and experimented with several ways to redirect a form once submitted. However, I only want to redirect a node form if the operation is t('Save'). If I set $form['#redirect'] = 'blah' in ...
  • 705
19 votes
4 answers
9k views

Easiest method for conditional fields in a form

What is the easiest way to get some javascript magic for enabling/disabling form fields based on another field's value? This sounds like something there should be an helper for somewhere, but I can't ...
  • 578
5 votes
2 answers
7k views

Theme Drupal Form API checkboxes as a grid

I have a custom form that displays a form element of about 2 dozen checkboxes. I would like to output them 3 per row, in a table if possible. How can I go about doing that? $form['preference'] = ...
  • 27.2k
5 votes
4 answers
3k views

Remove colons from Drupal form fields/labels

How can I remove the : from appearing after every label in forms made with the Drupal Form API?
  • 27.2k
6 votes
2 answers
7k views

When should the "container" form element be used?

The System module defines the container form element, but that form element is not documented in the Form API Reference. When should that form element be used?
  • 95.6k
51 votes
7 answers
64k views

How to a use a template file to theme a form?

While nodes, comments, blocks and many other things in Drupal are themed using theme template files (like node.tpl.php), forms are a different story. There are no theme template files for forms. How ...
  • 6,453
2 votes
1 answer
324 views

How can I add an object to a form?

How can I add an object to a form array to make it available to make it available to the hook_form_alter() implementations? I have an object I pass to a form, which may have new property. I would like ...
7 votes
4 answers
3k views

How to remove the default "Anonymous" from comment author name?

In the comment form field (core comment module) I would to leave the comment author name empty, in order to encourage commentators to come up with original epithets. What's the easiest way to do it?
  • 1,082
21 votes
6 answers
16k views

How to upload multiple files at once?

We need to upload multiple files of different types, is there a module that will check for valid mime types and upload only the valid files, (based on site settings, eg: png, doc, jpg, txt) ?
  • 1,367

1
132 133 134 135
136