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
10 views

Dynamic data forms and reports from non-Drupal databases

I have the task of displaying non-Drupal data which is stored in SQL Server within Drupal. I need to display search pages (ad-hoc style) and results based on page and field definitions stored in a SQL ...
0
votes
0answers
9 views

Dynamic menu breadcrumb for custom Drupal form

We have a form developed using form API in Drupal 7. Based on taxonomyID & nodeID in URL, the form fields will be pre-filled. I want to display the taxonomy term & node title in menu ...
0
votes
1answer
16 views

Add an input[type=“file”] label

i need to style the input[type="file"], the only way to really style them is to add a <label> which has the same for value as the input's id. Drupal does not provide a correct label in single ...
2
votes
1answer
24 views

When are '$form_state['values'] copied to '$form' on rebuild?

as far as I understand it whenever you submit and rebuild a form (e.g. 'Add another item' on fields with infinite cardinality) something like this happens: User submits a form with filled values ...
-3
votes
0answers
22 views

how to add ajax pager on tableselect form in drupal7 [on hold]

I have created a custom form with tableselect form element. How to add ajax pagination on tableselect form.
0
votes
5answers
56 views
+100

how to call a webservices on hook_form_FORM_ID_alter but not when the form is submitted and validation raise no error?

I have to call a webservice than dynamically modify the form. I used hook_form_FORM_ID_alter to do that. The problem is hook_form_FORM_ID_alter is also called on submit event when the form is not ...
0
votes
2answers
28 views

Building Custom Forms in Drupal 7

I'm new to Drupal 7 and installed it on my local machine to play around. I'd like to build a basic Job Posting Form and wanted to ask about questions/best practices regarding Drupal. This was the ...
0
votes
1answer
31 views

How to make form update/rebuild every page load?

Part of my custom form that gathers petition signatures includes some markup saying "last signer: Bob, 3 minutes ago", looked up from a database. But if the user does not submit the form, eg they ...
3
votes
1answer
51 views

How to preserve form values for user who navigates out of form and back?

I have a form that works, essentially, as a search / filter: foreach($search_properties as $property) { $form['properties'][$property->idProperty] = array( '#title' => ...
0
votes
1answer
36 views

Push value into array using form

I am working on developing a type of bucket that would store my selected content in some sort of data container (I am hoping to store it in an array). The selected data comes from default views, I ...
1
vote
3answers
54 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
68 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
41 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
37 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
14 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
38 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
36 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
1answer
28 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
41 views

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

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
26 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
19 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
51 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
31 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
29 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
28 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
12 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
14 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
34 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
62 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
37 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
33 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
40 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
57 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
33 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
38 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
32 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
41 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
47 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 ...