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
1answer
7 views

Add a Canvas Form Control in Drupal Custom Module

Im currently developing a module and I have this code in html: <canvas id="cnv" name="cnv" width="500" height="100"></canvas> I want it to add in my page using form controls but when I ...
0
votes
0answers
12 views

Having trouble selecting elements in jQuery with JS added on the form

I have a form with a file element and a button. When I click the button it is supposed to run some JS. I have tried three separate ways to get this to work but each way gives me a different result. ...
0
votes
1answer
13 views

How to remove delete link from admin manage fields ui

I have created a new entity type and progamatically added the fields it requires. My issues is that on the Manage Fields UI (the same interfaced used for managing fields for basic pages/articles), in ...
0
votes
0answers
13 views

How to prevent to create duplicate node on clicking submit button multiple time

I am using unique_field module. If a node already created and i want to create node with duplicate title(title is selected as unique field), it work fine. But if i click on submit button multiple ...
0
votes
1answer
23 views

how to Alter my Custom Form

I am using Drupal API 7 to create an registration form, there are : username, email dan password fields, but I want to make an username checking while user leave username field (ajax). I found an ...
-1
votes
1answer
17 views

How to show Drupal 7 Forgot password form and its confirmation message in jQuery UI dialog

I want to show Drupal 7 "Forgot password form" with in jQuery UI dialog with all its buttons. When user submits his email address confirmation message should also be shown in jQuery UI dialog along ...
0
votes
1answer
19 views

Disable click event on Next button on checkout form's first step if all cart products are removed

I am new to learning jQuery and JavaScript. I have small task that is becoming hard to solve. On step one of a checkout form #ps-cart-checkout-form, I have to disable <div ...
0
votes
0answers
24 views

How to dynamically remove field in custom form using AJAX

Based on the "Add-more button (with graceful degradation)" example available in Drupal examples module I have created a form that can add fields dynamically using AJAX, and now i want to add a ...
1
vote
1answer
11 views

Adding accept attribute to managed_file field to specify file types client-side

I've got a file field in a custom form like this: $form['image_upload'] = array( '#type' => 'managed_file', '#title' => t('Image upload'), '#description' => t('Upload png ...
0
votes
0answers
7 views

How to create an edit form for admin input

I would like to create from a module an add/edit form. For now I made an add form that looks like this: $form["locationTitle"] = array( '#type' => 'textfield', '#title' => t("Vietas ...
-1
votes
1answer
10 views

field drag and drop is not working when adding new survey in drupal 7 [closed]

I have already installed and enabled modules survey, entity,features,form_builder and views.But When adding New survey (Structure -» Surveys->add survey) the fileds are not able to drag from palette. ...
0
votes
4answers
53 views

Where do I put and How do I use form_state['redirect']

The documentation says to put $form_state['redirect'] in your code when you want to send the form to a new page. However, when I use it in the third page submit handler of my multi-page form it ...
0
votes
0answers
13 views

Create a registration form

I've already customized the default user_register form with hook_form_register_form_alter(). That form is using complex multistep form and connects with a web service for validating etc. Right now I ...
0
votes
1answer
18 views

Adding a validation step via hook_form_FORM_ID_alter()

I am trying to add a custom validation function to an existing form. I am using hook_form_FORM_ID_alter() to edit the form. I am then adding a new function to the #validation array. When I use dpm() ...
0
votes
0answers
14 views

Adding custom content to sidebar in admin section's node edit page

I want to add a custom image to the sidebar of the edit node page in the admin section. Is there a hook that can allow me to do this? Edie: I should point out the the image I want to show is ...
0
votes
0answers
8 views

Adding a styled progress bar under Form Title but above #prefix text in Custom Module

I have a multi page form. This form has a title set in the hook menu function at the top as they are wont to do. It displays the title of the form, with this code: 'title' => 'The Tool', I then ...
1
vote
1answer
12 views

Form inputs being disabed during the Ajax request

I'm working on a module where I have a form inside of a block, I'm using Ajax to submit the form, but I noticed that the form's inputs are disabled when sending a request with Ajax. Well in my case I ...
0
votes
1answer
14 views

Combine Token title with url in an email

I send emails automatically to users. There is a link in these mails, which points to a node. But I want to use the node title as an alias for this link, so that the link is not directly displayed in ...
0
votes
1answer
23 views

how to style printed value of option radios checkbox?

i use drupal 6. i have this form in a file .module : function comment_fields_example_comment_fields_info_alter(&$info) { $info['all'] = array( 'feeling' => array( '#title' => t('Come ...
0
votes
1answer
20 views

Remove field data in submit function

Drupal 7. On form validate, I want to: check the value of one of the form fields [field-1] based on that value, completely remove another field [field-2] together with its values, from the form If ...
0
votes
2answers
29 views

How to autofill text fields in form?

I have two pages, on the first page, the user types in an ID. Using hook_form_alter, I then override the submit function and add my own functionality that will then grab information from a database ...
0
votes
0answers
9 views

A question about performance with Form API and Ajax callbacks

Im creating a dynamic form, using FORM API. Several lines of results, fetched from DB, and several functionnalities like deleting a row, adding a row, modifying quantites and calculating total prices. ...
1
vote
2answers
27 views

Call a function in JS file from drupal

I have included a javascript in the module "myid" I've been developing in drupal by using this code: function myid_init() { drupal_add_js(drupal_get_path("module", "myid") . "js/myid.js"); } ...
0
votes
1answer
16 views

Firing ajax_callback on textfield after a minimum number of character

Ive created a textfield with an ajax callback with 'keyup' event. In need the callback function to be fired only after a certain number of character ... I can control the number of character of the ...
1
vote
1answer
66 views

Invoke a camera to start in Drupal 7 Forms API

I am currently developing a module which must be capable of taking a picture. I dont know how will I make it? How will I invoke a camera to open just by clicking a button? Any idea?
1
vote
1answer
15 views

How do I pull a field value from a form field in to my inline entity form?

I'm trying to do something which I would think is fairly simple, but I'm just stumped right now, hoping somebody can help. I have an entity called 'page', and in that entity I have inline entities ...
0
votes
2answers
17 views

Disable the submission of a form

I need to make a form read-only under certains conditions : what I did is to not add the $form['submit'] button. This way I can't submit the form. But I wonder if it is enough ... Do you know if I ...
0
votes
0answers
24 views

Mixed POST and GET submission

I am building a page with a filtered table of data. I would like the filter to submit the date field information in the URL, while the op, form_build_id and the other Drupal internal fields are kept ...
0
votes
1answer
21 views

How to update the page breadcrumb when using theme page

I have an entity form(theme page to display it) . I have used hook_node_view() to handle breadcrumbs for nodes. But I don't find any place to handle this $breadcrumb when I have a form and a theme ...
0
votes
0answers
19 views

Need to load form manually after autocomplete field value selected

I'm fairly new to Drupal and have spent most of my time in the form API. The one thing that is perplexing me is how to load the field values of a form after a value has been selected in my auto ...
4
votes
1answer
54 views

Get entity id in hook_form_BASE_FORM_ID_alter()

I am working on porting a D7 module to D8. As in Drupal 8 all things are represented as entity, menu items are also represented as entity. Now I added a hook_form_BASE_FORM_ID_alter() implementation ...
0
votes
0answers
14 views

Saving a file with a custom filename

I have a custom form that uploads a couple of images used in static designs. What's the best means of having these files uploaded to a directory under public:// with a hardcoded filename to be set on ...
2
votes
1answer
35 views

Form_state empty after ajax callback

Im struggling with my form since yesterday ... I can't find a way to retrieve values from form_state in my form function. heres my different pieces of code : function mymodule_menu() { ...
2
votes
1answer
52 views

jQuery events are lost after form reload

First I thought that this would not be a Drupal specific problem, but jQuery specific solutions didn't solved it. I hope you have some advices. I have a form with lots of fieldsets. To find the right ...
0
votes
0answers
16 views

Update Textfield outside of form on ajax callback

I have a page contains two forms, I want the fields in the second fomulaire either change when ajax callback launches the first form. How to update Textfield outside of the form on ajax callback ? ...
2
votes
0answers
56 views

Form with AJAX callback inside an AJAX callback doesn't work

I hope the question doesn't sound strange. In a nutshell: I have a Drupal form, but I am adding it to the page as the result of an AJAX callback. I need this form to trigger a new callback. My code ...
0
votes
1answer
24 views

Loading a form from a form include file in a module

I have an external form that needs to be loaded inside a template file, used by a block. Right now, i'm a bit confused as to how to load this .inc. Looking at the API docs point to ...
0
votes
0answers
30 views

Search API Custom autocomplete callback return field values

I am creating a custom form with an autocomplete callback that searches in my search index called client_index <?php function module_search_client($string) { dpm($string); $matches = array(); ...
0
votes
2answers
39 views

form_set_error() redirects to raw ajax response page

I have a page with a simple view. Above the view there is a menu link that when clicked loads a node form with a required file field. The form is fetched and loaded using ajax_commands into a div on ...
1
vote
1answer
59 views

Form submit with radio in table has data in form_state['input'] and not in form_state['values']

While developing a form for Drupal 7, I need a few radio groups, placed inside a table (one radio group per table row). The radios are defined as '#type' => 'radio' (not radios) and grouped ...
-3
votes
1answer
63 views

Fetch data from database and show in custom module's form [closed]

I used the following code in my module to build a form : $form['promo_type'] = array( '#type' => 'select', '#title' => 'Promotion Type', '#options' => array(t('Digital Coupon')), ); ...
0
votes
1answer
49 views

Custom submit button callback overrides default callback?

I am trying to accomplish the following functionality: I have a profile2 registration form to which I have added a custom form element (just a submit button) using hook_form_alter(). The submit ...
0
votes
1answer
28 views

adding data attribute to option value in Drupal 6

I have a form, like this: $form['my_case_type_list']=array( '#type'=>'select', '#title' => 'Issue Type', '#options' => $my_list, ...
1
vote
1answer
23 views

How to add html to the form?

I am creating a custom module. I have a form that I would like to add some HTML to, but I don't know what the best way to do this. In this example, I have a page with a textbox, dropdown list, and ...
0
votes
0answers
90 views

How do I get ajax callbacks from working example to execute in Views handlers?

I can't seem to get a callback function to execute in Drupal 7 Views 3 argument handler. All I want to do is have one displayed form element change when the user changes another. Simple. This ...
0
votes
2answers
45 views

Make form to show multiple field widgets with predefined values

I have a node form with multivalue field (cardinality unlimited). I need to show user 3 widgets if this field with predefined value (like shown at screenshot). At screenshots I show the current form, ...
4
votes
1answer
77 views

How to pass Javascript variable with form on submit?

I want to pass a variable created with Javascript to $form_state so that I can use this variable in the form_submit function. In an ajaxified form I can use: ...
0
votes
0answers
56 views

Prepopulate field collection programmatically

I have a content type with field collection field (unlimited cardinality). Each collection has image field (required) and long text field. How can I prepopulate node form with multiple collections? I ...
1
vote
0answers
25 views

How to work around server limitations on form size?

I have a form pretty similar to one you can see on your own sites under http://example.com/admin/people/permissions - that is, rows with checkboxes. A lot of checkboxes. I used this code to count ...
0
votes
1answer
50 views

Using #states to disable a field collection field

I am trying to disable a date field's second value, inside a field collection, but it isn't working. My hook_form_alter has this: ...