The form API is a very strong, robust, easy and scalable API for creating forms in Drupal.

learn more… | top users | synonyms (1)

0
votes
0answers
11 views

3 level Dependent dropdown in a custom module

I have 3 dropdowns in a custom module. The second one depends of the first one and the third one depends of the second one. The 3 levels are 1-Province, 2-Canton, 3-District. If I change an option of ...
0
votes
0answers
14 views

Have more rows on the selectbox widget

I am trying to have more options visible in a select-box widget. I have tried #size, to no avail. function videomodule_form_video_node_form_alter(&$form, &$form_state, $form_id) { ...
-1
votes
0answers
13 views

Creating operation links in tableselect

I have a problem how to add operations link like "edit", "delete". I had a look how it's done in another modules, but it doesn't display any link still. My code looks like foreach ($result as ...
0
votes
0answers
14 views

Add #ajax button to tableselect column

I created a tableselect table and I want to put button with ajax callback for each row. I have a issue how to call the callback function with some argument (in my case it would be a item ID). It is ...
0
votes
0answers
15 views

Handling uploaded files FAPI

I've created quit big form with conditional fields and ajax "add more" button for many file upload fields (file, not managed_files type) divided by category/subcategory. For each subcategory there can ...
-1
votes
1answer
29 views

How to render a link as a button

I am using Drupal 7 and I would like to render a link (anchor tag) the same as a submit button. Does Drupal 7 allow for this (say by using the button type) or do I have to use CSS to accomplish this?
0
votes
1answer
19 views

How to add field to fieldset by ajax?

I have a fieldset with one field by default. I want to add new fields by ajax (button "new item"). I can do it for usual field, but I have a problem with fieldsets. How to do that? For usual fields I ...
0
votes
0answers
8 views

Add Widget to Form? [duplicate]

I right now want to use the nice date widget(from Date Mod) in a form. The issue is the Date API, from what I found, does not provide a form type like the widget. Also, I need 10 reputation in order ...
1
vote
0answers
13 views

Programmatically edit an image form field on a user account

I have added an image field to user accounts using the "Manage Fields" user interface. I am trying to make a form that users can use to change their picture. Below is some code I have tried. In it, ...
3
votes
1answer
35 views

#ajax['path'] vs #ajax['callback']?

ajax['path'] Description: This is the Drupal menu path for a callback function which will generate HTML and return the string of HTML to Drupal. The result will replace the div specified ...
0
votes
3answers
39 views

display a taxonomy terms as autocomplete using form API [on hold]

I am writing my own module. I want to display a taxonomy terms as a autocomplete field in my form using form API. How can I do that? I am using Drupal7.
0
votes
0answers
13 views

How can I include a node reference field in my form?

My module implements hook_menu() in order to define a settings page: function MYMODULE_menu() { $items = array( 'admin/config/system/mymodule' => array( 'title' => ...
0
votes
1answer
13 views

Export Content Type to a Form Like Structure?

So, I'm just getting really lazy. I have to make new custom forms for users to input data. The form matches the Content Type exactly(except for somethings being generated server-side). Is there a way ...
0
votes
2answers
13 views

Drupal updating form fields on file upload

I am trying to update form fields based on an uploaded file. Specifically, the text that is displayed on the webpage. If the user then presses a submit button, these values are then passed to ...
-1
votes
0answers
15 views

D7: Reset all form values after form_set_error [on hold]

I am working with Commerce Cart and it checks for remaining stock on form validate. I notice that when form_set_error occurs and the first line item is out of stock but the second one isn't, the ...
0
votes
0answers
7 views

Display a form in front office theme in Drupal 6

i want to theme some forms, and i've no difficulty to modify them with the hook form alter. My problem is that thoses form are displayed in the back office theme and i want them to be displayed in the ...
2
votes
3answers
57 views

Enforcing minimum number of characters for #autocomplete_path

I have a form that is using #autocomplete_path on a textfield. In general it works fine. Is there a way to have the autocomplete callback not fire until a minimum number of characters have been ...
0
votes
1answer
25 views

How to add tabs to a form without a module

I want to add horizontal tabs (not vertical tabs as shown in examples) as shown on the site : http://www.nseindia.com/ (Get Quotes on the top). I tried using menu modules like superfish and nice ...
0
votes
1answer
9 views

How to validate links before moving to different location

This would be most simple functional question in Drupal 7. Now below mentioned things are mandatory to do and cant change the functionality. 1) I have created a custom block in module. 2) I have ...
-1
votes
0answers
10 views

Rebuild a form after form set error in formvalidation handler [closed]

Is there a way out to rebuild a form after the form sets error in form validation. I have tried using $form_state['rebuild'] = TRUE, but no success. Any help will be appreciated.
0
votes
0answers
21 views

how to prepend or append syntax to a form element, without changing default output?

Is there a way for a module to prepend or append <div> to a form element, without interfering with the way other modules renders it? I know I can construct syntax from scratch like that: ...
0
votes
0answers
23 views

Drupal 7 date_popup : Howto align label to date field on the same line with label on the left

I'm using FORM API with Drupal 7. I try to align label with a date_popup field on the same line on the form, with the label on the left of the date field. I can only align the label on the right of ...
0
votes
1answer
21 views

TinyMCE not appearing on custom form

I am creating a custom form and have run into a problem. I'm using the WYSIWYG module and for some reason the text areas on this custom form don't show as rich text editors (tinymce shows on other ...
2
votes
1answer
24 views

drupal_get_form of custom content types

I am wracking my brain to try to figure out how to retrieve a custom content type's edit form programatically. For example, I created a content type called "address", and have this: $form = ...
2
votes
1answer
22 views

Form API Radio Button Submit

I'm building a form that is being built by pulling information from an api and loops through it. The issue I'm having is I cant seem to pass the information to the submit page. Here is a snippit of ...
5
votes
2answers
39 views

How do I append HTML after a form title?

This is the output I want: <label>Name</label><span>!</span> The only way I can think of is to concatenate my HTML to the form title value '#title' => t('Name') . ...
1
vote
2answers
43 views

Specifying text format when creating field on custom node type

I have a module that's creating a custom node type. I'm attaching a textarea to this node type. Currently it works, but the text formatting defaults to "Plain Text." I would like to specify during ...
-1
votes
0answers
26 views

Use Form API in node [closed]

what I am trying to do is to create a form with the Form API, so that users can post questions for a topic. The questions have to be moderated (publish / unpublish questions), so I decided to write my ...
0
votes
1answer
34 views

Selected file gets reset after clicking on +Add More button

am implementing a form and in that form it requires that two form element should be coming under one Add more button, so user can add any number of fields. Here is the code which i am using to create ...
4
votes
2answers
125 views

Adding target _blank to ajax form based on response

I have been pulling my hair out on this for a few days now, and I cannot seem to actually execute something as simple as this successfully on submission of my form. What I am trying to do is this... ...
-1
votes
0answers
30 views

D7 - Creating new taxonony term while adding new node [duplicate]

I'm trying to develop a new module which adds an ability to create new taxonomy term via ajax while creating new node. I know there is a Hierarchical Select module which can do it, but there are some ...
-1
votes
0answers
43 views

Ajax dropdownlist not working properly

I added a custom form that contain 3 level drop down list it work's very fine, but i have a problem when i chooses the first drop-down list, the area and city fields changes successfully after that ...
0
votes
1answer
22 views

how to add field_image widget (imagefield crop) to a custom form api [duplicate]

How can i add to my custom form api in my custom module the default widget from field_image? I am using imagefield_crop module widget and it works in node/add form, but i cannot replicate it in my ...
0
votes
2answers
22 views

How can i fetch the value from database in a simple module?

I'm working in drupal 7 and I have tried all help but not able to fetch the value from database. function myModule_load($node){ $result = db_query("SELECT * FROM {uc_auction_bids} WHERE nid ...
2
votes
1answer
29 views

Adding title attribute to #type password_confirm

Is it possible to add a title attribute through a form_alter to element #type 'password_confirm'? For example, I have a form with the following fields: email password password confirm To apply a ...
0
votes
1answer
20 views

7 - FAPI: form_set_error messages on bottom of page or dialog box

My ajax FAPI multi-step form is rather large, the error validation message are located by default at the top. But users can't see these messages as they are clicking submit on bottom of a large form ...
0
votes
1answer
39 views

How to display default value of disabled form elements after failed validation?

I have a form with some disabled form elements. When the form fails validation and is sent back to the user, the disabled fields are empty. How can I make the disabled fields display the default ...
0
votes
0answers
17 views

Forms on top of content type (blog, etc) but in frontpage

I am trying to add content forms (Title form and Body form ) on top of the blog (or any other content type) but in the frontpage. That is for the frontend user do not need to open a new page to add ...
0
votes
0answers
26 views

Multiple actions on multi-step form

I have a multi step form that has 4 pages. On the second page there are two submits that call separate functions that are the deciding factor on whether the next step should be page 3 or page 4. ...
3
votes
2answers
34 views

is Form api ajax attribute good in performance ? does it require an entire bootsrap?

Ajax is used for better user experience and also for better performance in a webapp ( change only the requested item instead of the entire page ). In my case the form will require ajax functionality, ...
2
votes
1answer
28 views

Add multiple fields in +Add more button causes problem in sequence

I am implementing a form and in that form it requires that two form element should be coming under one Add more button, so user can add any number of fields. Here is the code which i am using to ...
0
votes
0answers
17 views

A second database issue This only works with two databases of the same type

I have an issue with a form, I asked one question but actually found i should be asking. I want to create forms that submit data to a postgresql DB, i cannot change the drupal site to run this way. ...
0
votes
1answer
44 views

My form does not show any action on clicking the submit button

I have create custom module with hook_block , inside the block i want form but the problem ( my from does not take any action of submit ). This is my code function loan_calculator_block_info() { // ...
0
votes
2answers
51 views

Pass info from page link to form

I am trying to build a custom module that uses a theme page to display a list of items withing a table. Each item has a unique ID. and I would like to have links within this table so that my users can ...
1
vote
1answer
18 views

How to create an end date field in a hook_form_alter

I've succeeded creating a simple date_popup field with the following code : $form['date_start'] = array( '#type' => 'date_popup', '#title' => t('Start date'), '#default_value' => '', ...
2
votes
1answer
21 views

load node_type_form form

I need to load and print drupal 'internal' form on the page, which id is "node_type_form" I have: $form = drupal_get_form("node_type_form"); $html = drupal_render($form); echo $html; it only ...
0
votes
2answers
33 views

How to save validated third party API data if form validation fails

Here's my issue. During user register I'm adding fields via form_alter and creating a stripe account. When validation fails $form_state gets wiped out and when the user passes through validation ...
1
vote
2answers
24 views

How to add a class to vertical tabs created using Form API?

Form API element vertical_tabs does not have #attributes property. I have two kinds of tabs. The first one is language dependent. The second one has language independent values, just shows a preview ...
0
votes
2answers
36 views

Display date field labels within selectors

Is there a way to move the labels of the day/month/year components inside the selectors (like Facebook has it on their registration page, see 'Birthday')? I have placeholders in all my text fields and ...
3
votes
1answer
58 views

How do I programatically submit a webform via drupal_form_submit?

Drupal 7, Webform 3 I want to programmatically submit a webform via drupal_form_submit. However, I'm having difficulty finding a $form_state structure that works. I've submitted my webform via the ui ...

1 2 3 4 5 23