form-api

Filter and View screens on different pages

Situation: In Drupal, when you use Views module, it restricts to display Search Form and Results on the same page. E.g. Page A = (Search Form + Results). There is no option in Views module interface to move/copy Search Form to another page. E.g. Page A = Search Form, Page B = Results Form Question: Is it allowed by Views architectur...

drupal form textfield #default_value not working

I am working on a custom module with multi-page form on drupal 6. I found that #default_value is not working when my '#type' => 'textfield'. However, when '#type'=>'textarea', it displays correctly with the '#default_value' specified. Basically, I wrote a FormFactory to return different form definition ($form) based on the post param...

Drupal: Username input field?

How do I use the form API to make a field that only accepts names of registered users? I know how to do the autocomplete to suggest user names already. Specifically, I'm looking to replicate the field in the normal node creation process that allows the user to specify an author. ...

Drupal 6: Only inserting first character of value to MySQL

I am working with a hook_form_alter on a CCK type (for you drupal-ers). I have a field that is normally a select list in my node form. However, in this instance, I want to hide the select list, and populate its value in the form with an SQL query. Everything was going nicely. I could see that my desired value was showing up in the HTML...

get values from form API checkboxes

This is a module that I'm working on to create a custom filtered search. But i have no idea on getting the values of form type checkboxes... I searched but nothing yet! <?php function my_module_menu() { $items = array(); $items['my_module/form'] = array( 'title' => t('My form'), 'page callback' => 'my_module_form', 'acc...

Drupal Form API: Create Form Elements based on the database values (Dynamic Form Creation)

Hello Everyone, I am creating a form where i have to populate "X" form elements (text-fields to be specific) based on values in the database (X number of elements, properties of each element etc). Is there a way to do this using the Drupal Form API or should i start from somewhere else. I tried using a for() loop in the form generating...