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

Form API focus on first input

When my form load I would like to set the focus on the first field in the form. I know I can use jquery to do this by doing $('inout id').focus();. Where would I put this code so that it only runs on ...
0
votes
1answer
15 views

Form element title is not displaying translation

I have got my own module providing a form and there is one element called "Estimated time" defined like this: $form['informacie_o_incidente']['field_incident_doba'] = array( '#title' => ...
0
votes
1answer
27 views

How can I put form elements into a table and have a submit at the bottom?

I'm working on this module and I want it displays a page as follows. What I am doing to get that is just displaying a table through theme() and typing out the HTML for the upload. I want the whole ...
2
votes
2answers
36 views

arg(1) changed when doing ajax in hook_form

I created a custom module named my_module. In hook_menu() I define the following path. $items['my-module/item'] = array( 'title' => 'Item', 'page callback' => 'drupal_get_form', 'page ...
1
vote
1answer
26 views

Button with Drupal Behavior jQuery Conflicting with AJAX 'Add More' Button on Unlimited Cardinality Field

I have a form with an unlimited cardinality field that creates an 'Add more' button to add more fields. I also have a separate pair of fields. One of these fields has a value prepopulated on starting ...
0
votes
1answer
32 views

form submit function never gets called.

My drupal form submit function is not called. validation function is called. Form name is Mymodule_user_profile_form($form, &$form_state), validation function name is ...
2
votes
1answer
16 views

Form Parameters

Some forms like the user_login form have $form and &$form_state for parameters. The Drupal 7 Module Development book also have the 2 parameters in their example. But in the Quickstart Guide, the ...
0
votes
0answers
19 views

Captcha doesn't validate

I'm displaying a custom form in a block. I'm adding a captcha to my custom form like so: function requestform(){ $form['firstName'] = array( '#type' => 'textfield', '#title' => '', ...
0
votes
0answers
14 views

How to use nodereference_select in custom form (set default value) D6

I am building a custom form using the Form API. I want to show a nodereference_select in my form. However I have some difficulties setting the default value and the list of values. //Create array of ...
0
votes
0answers
29 views

Change an existing textarea to full_html

I have PET module enabled. As per my requirement, I have to change the mail body to a full_html one from normal textarea. It changes to ckeditor when I changed #type and #format. following is my code: ...
4
votes
3answers
65 views

Form API Select List will not show empty option

I am trying to add a form that forces you to select an option from a dropdown. The documentation says: If #required is TRUE and there is no #default_value, an empty option is added to the select ...
0
votes
0answers
18 views

form_set_error highlight single field in multiple value field

Is it possible to highlight only one field with form_set_error when this field belongs to a multiple value field. Let's say I have a field name field_videos which accepts multiples values. After ...
2
votes
1answer
33 views

How can I display a form button on top of the form?

In my custom module, I have added a button to the node edit form, using the following code. $form['actions']['my_submit'] = array( '#type' => 'submit', '#value' => t('My custom ...
1
vote
1answer
11 views

Fill #options of select field

I have a select field for a content type which has options generated dynamically. The options are updated in hook_form_alter(). The problem is that when I try to manipulate the posted data in submit ...
0
votes
1answer
28 views

Toggle text field depending on checkbox value in drupal 6

I need to toggle a textbox depending upon the checkbox value. Basically i need to take email entries for updates. Here is the form elements I used. $form['chkupdates'] = array( '#type' ...

1 2 3 4 5 70
15 30 50 per page