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

learn more… | top users | synonyms (1)

1
vote
2answers
21 views

How to export custom module form content as PDF file in drupal 7?

I have a custom module with some form fields. I want to submit this form and generate pdf file of user filled values in new tab. I am trying with TCPDF but it doesn't display any fieldset ( as border ...
1
vote
3answers
61 views

How to intetrupt a form submission in drupal

I have made a custom module where I create one page. In that page I load the existing form for creating a new content and also add a password field. In my loaded form I have an email field. I want ...
0
votes
2answers
35 views

How to debug missing default value of managed file?

I have a form with images. It also contains title and alt for 3 languages, so when I select them in one query, I get the same managed file fid 3 times. But that's not the problem. Relevant part of ...
2
votes
2answers
31 views

Create a form that will allow the user to select files from server

I have a custom module and I'm creating an administrator interface for this module. I need to give a "Select File" button to the moderator that will allow him to browse a specific folder in the server ...
0
votes
0answers
11 views

Ajax-Form and #value

ok, so I have a custom form with some ajax stuff. The relevant part is this: $form['prices']['saleprice'] = array( '#type' => 'textfield', '#title' => 'Price', '#required' => ...
0
votes
1answer
23 views

Is there a way to upload files to the theme directory

I use the following code to upload images should be used in slideshow of the theme settings theme-settings.php: for ($i = 0; $i < 7; $i++){ ...
0
votes
0answers
28 views

How to get $form_state['values'] after a drupal_get_form() call?

I have an form in a block with ajax submission. The block view code calls drupal_get_form, adds some other info, uses a custom theme tpl to create the block. I want to replace the form in the block ...
0
votes
1answer
18 views

Saving form data of forms modified with form_alter hook

I understand how to add stuff like checkboxes and fieldsets to existing forms (e.g. the form displayed on the node edit page) using _form_alter. But what I don't understand is how to collect the input ...
0
votes
0answers
13 views

How to find a function?

Using the xray module I can see that a page calls the function: function foia_generator_entityform_edit_form() How can I track the function down and take a look at what it contains?
0
votes
1answer
37 views

Can't save custom field data: form submit function doesn't fire

I've added custom "markup" field to the commerce_product table, next I've implemented hook_form_FORM-ID_alter, but submit function doesn't executed.
1
vote
1answer
29 views

How to apply one AJAX to all form elements?

#ajax is used by: button, checkbox, checkboxes, image button, password, radio, radios, select, submit, tableselect, textarea, text_format, textfield Sadly, form is not on the list. But on one ...
0
votes
1answer
35 views

Entityform - “The form has become outdated.” error

I have an entityform that appears on a page, for some reason the form will not submit ... // implement hook_menu function foiagen_menu() { $items['node/%node/foiagen'] = array( 'title' => ...
0
votes
2answers
39 views

Which hook invoke on saving Content.? [on hold]

Story: I have a content Type "Issues". I have few fields on this content type. I am using function bartik_form_alter(&$form, &$form_state, $form_id) but it fires when I view node and submit or ...
0
votes
1answer
26 views

Wrap form field

I want to render a form element like this: <div class="form-group clearfix"> <label>Title: <span class="red">*</span></label> <div class="pull-left"> ...
0
votes
0answers
27 views

Changing the default value for a form and pre-populating a form with user input

Drupal novice here, and I'm at the end of my wits. I'm trying to edit a textfield form so that upon submission and redirection, the value in the form will prepopulate to what the user put in the ...
0
votes
0answers
40 views

How to Create a form for an additional Form for my Entity [on hold]

I think I might be missing something simple here but can’t seem to find the answer. I’ve created a custom module for my Entities. And have made a form for it using 'admin ui’ What I would like to ...
0
votes
2answers
25 views

FAPI Fivestar settings in custom form

I have a multistep form with mforms in forth step my form have fivestar field from a review node content type. All fivestar field display option are set to basic, but fields are displaying ...
0
votes
1answer
17 views

Form table pager

I'm building a module that displays a dynamic list of Content types that has some extension. I'm trying to add a Pager (like in Views). But all examples that I found uses db_select like: $query = ...
0
votes
2answers
29 views

Show table records in view via hook_form

I managed to get things looking a bit better, However I dont know why the checkbox below is showing like the picture. I want to select the checkbox and make it do something with the corresponding ...
3
votes
3answers
48 views

#states does not hide #suffix in a form

I am new to Drupal, so please be fair with me :) I am trying to create a custom form using FAPI. The code is as follows : $form['format_document'] = array( '#type' => 'radios', '#options' ...
0
votes
1answer
30 views

Custom create account form included in a create content form

I am new to Drupal 7 ( 1 month ) and have to do a rather complex task. I have a content type (lets call it MyContent) for which i tried to create a custom form (I imported the fields from the ...
0
votes
1answer
28 views

Set select list option value

I'm trying to set value of select list programmatically with hook form alter I have select list with options: $options = array(125 => 'USA'); and setting value like this ...
1
vote
2answers
27 views

Insert image tag in checkboxes list

A Form having a form element of term reference with checkboxes widget. I want to insert a image tag with each taxonomy term name, For example here is the html of taxonomy term reference < div ...
0
votes
2answers
11 views

Drupal 7: CAS-protected Webform does not submit

I have a form that was created using Webform 7.x-4.0-rc3. The completed form submits successfully, form values are stored correctly, notification emails are generated, and the confirmation page is ...
0
votes
0answers
13 views

3 or 4 level dependent Drupal form

I'm trying to set up 3 or 4 level dependent. The options change as expected, but I want to hide the third and fourth options (the OK button in this case) when the first dropdown selection is changed. ...
0
votes
1answer
30 views

Altering Webform email %value before sending email

I summon your wisdom on this day because I can't figure out how to alter submitted Webform values that are used in email templates. Here's my situation: I have a "contact us" form (set with Webform ...
0
votes
0answers
19 views

Pre-Fill the Customized Registration Form which populates the existing values in the field

On my site, we want the user to search his personal information through an email and then go to Registration Page for my modification. If the email is correct, the Registration form should pre-fill ...
1
vote
2answers
61 views

Drupal 7 : Programmatically validate form by form ID

Intro - i am trying to implement Sales Force form within Drupal FAPI but now it requires to add captcha so i need to send first request to internal page so i could validate captcha and only after this ...
0
votes
1answer
36 views

Programmatically add PDF file to user

So using the 'file' module i have added a field to the user table called 'user_files'. What i want to know if how can i programmatically add a file to the user, so that it is displayed on the users ...
0
votes
2answers
28 views

Showing different page layouts based on form data

I'm trying to build a multi step form. Before the second step I have to process the data inserted in step one and render different layout and form fields based on the results. I use "drupal_get_form" ...
0
votes
1answer
32 views

Can't see error messages when creating Drupal form in a separate file

Suppose, I want to use Drupal libraries inside a separate php file to generate a form. I created 3 functions: function add_form function add_form_validate function add_form_submit And then used ...
0
votes
1answer
34 views

How to create dynamic select list in form using FAPI

I am using Drupal 7. I have created two form (FAPI) fields of type select , State and District. The district field should contain the dynamic options based on the state selected. State field: ...
0
votes
1answer
37 views

Converting JSON to select list options

I have an array that I have JSON decoded from a JSON object. Below is my array I am using for select options. The problem is each select options has a option group with a number (0-11). How can I ...
0
votes
1answer
51 views

Webform confirmation message on same reloaded page

Webform has option to reload the page when submitting the form, but it just refresh the page and doesn't show any confirmation message that the message was sent etc. This might look misleading for ...
1
vote
1answer
31 views

Is there any way to create validation function in system_settings_form

Creating a form having two file type element, i want to check that if user uploaded file any file, then user must upload both file, so is there any way to add a validate function in ...
-1
votes
2answers
30 views

AJAX added form element disappears after failed validation?

I have a form field which uses the #ajax element. When a user interacts with this field a function is called and a new form element is added to the form and then the new form is displayed to the user. ...
0
votes
1answer
23 views

Insert GET parametes to form api

I have a view with exposed filters form inside. I want to add a GET parameter to the action of the form. What i want to achieve is that when the user submits the form, the parameter will be executed. ...
1
vote
2answers
37 views

Is there a number field with + and - feature?

I am working with Form API to create a customized form shown in a block. Most of the fields are textfields. I need a +/- feature for a numeric textfield, i.e.: Is there an existing field like the ...
0
votes
1answer
31 views

ajax form element sometimes triggers submit

I have found some strange behaviour of form ajax elements. I have added #ajax to my form elements: ['#ajax'] = array( 'callback' => 'mymodule_ajax_callback', 'event' => 'change', ...
0
votes
1answer
38 views

Newbie Form Question: I'm only getting hidden fields

I am trying to produce a form that only consists of 1 button. I have created a tab in the user menu screen with the following... $items['user/%/user_options'] = array( 'title' => ...
0
votes
1answer
46 views

How to add an editable text box to a page

So i have created a page which uses an XML feed to generate some output. I want to be able to add a textarea from the FORM API so that i can allow user of my site to enter some details on to the form ...
0
votes
1answer
22 views

D7 - List entries on config form

I have what should be a simple question. I am coding a module that allows the user to add meta and link tags to the of your HTML page..think of something similar to CSS injector. (I'm sure something ...
1
vote
1answer
38 views

Add taxonomy term in popup

I have a select list with some options. But now I also want an option Other. And when you select the Other option there has to open a pop-up screen with the add term to vocabulary form in it. The term ...
0
votes
1answer
79 views

How to trigger hook_form_alter() on my custom $form?

I have written a custom module which builds a custom user_profile_form(): mymodule_user_profile_form($form, $form_state, $user) { module_load_include('inc', 'user', 'user.pages'); $form = ...
0
votes
0answers
9 views

form w #ajax attribute to change content based on keyword input to be called to query Json from youtube

I am a PHP developer but new to Drupal development, although I am creating a module. Seen here http://vperry.co/drupal-aif-14/ I have created block that is displaying Json from Youtube, using a query ...
2
votes
1answer
42 views

Form API #states with #default_value?

I have a form which has a select with a #default_value which get's set when the user has errors/has filled out the form. Then I have two fields with a #states that show them when the select has a ...
0
votes
0answers
18 views

method replace dosn't work in ajax form

I've a select form that implements ajax. When the value of the select change an other form has to change. You can see in the next code. $form['a1']= array( '#type' => 'select', ...
0
votes
0answers
22 views

Theme for Form API field with custom template

I am unsure how to make variables available to my custom template for a Form API field. So far I have got the below: Define form: /** * Defines search form */ function ...
0
votes
0answers
20 views

ajax form element with normal submit

I need help/suggestions with ajax forms. I have a simple form, with a few elements and submit button. What i want to do is save each form field async. with ajax before user submits form. A have a ...
0
votes
1answer
33 views

Approach to create a custom search form for an apache solr search

I am creating a search similar to the example shown below: I am looking for the best approach to do this. My current approach is to alter the drupal default search form and add the additional ...