This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Dynamic form - how to

Hi,

I need a help from Drupal guru with deep understanding of Drupal forms and forms processing.
I'd like to build a form that can change itself by adding or removing fields, as a reaction on the appropriate buttons and then catch all the fields data in _submit function.
Let me illustrate the task with the code below. It is a managing system of the spy store, where operator can add and remove orders of the clients and store results in the DB.

// get the data array (see function code below)
$data = get_data();

// build the form dynamically according to the $data array
$form['client'] = array('#type' => 'textfield','#title' => t('Client'),'#default_value'=> $data['client'],'#tree' => true,);
$form['orders'] = array('#type' => 'fieldset', '#title' => t('Orders'), '#tree' => true,);
foreach ($data['orders'] as $order_id => $order_description) {
$form['orders'][$order_id] = array('#type' => 'textfield','#title' => t('Order '.$order_id),'#default_value'=>$order_description,);
}

// first two options should modify the form
$form['add_order'] = array('#type' => 'button', '#name' => 'op', '#value' => t('Add order'));
$form['delete_order'] = array('#type' => 'button', '#name' => 'op', '#value' => t('Delete order'));
$form['submit'] = array('#type' => 'submit', '#name' => 'op', '#value' => t('Save'));

$output = drupal_get_form('client_form', $form);
return $output;

automatic flash video conversion, advanced uploading progress meter or progressbar

Were you searching out video sharing solution? Or did you hope to add cool progressbar?

We have hacked the video.module and image.module and they now feature
1 video file uploading
2 file uploading progressbar
3 video sharing and playing
4 official categories

You can login our website for further details. Our website is
http://www.maybor.com/

multi-page form gets redirected on certain pages (how do I intercept forms api calls)?

Hi,

I've got a large multi-page form (upwards of 11 pages depending on what user wants to fill in) that works, but for certain pages drupal intercepts the submit button and redirects to the first page (losing any entered variables for the last page the user was on).

The way I'm handling everything is:
Each form has a hidden variable that keeps track of the current page.
At the top of my page function, I'm checking for this variable in $_POST['edit'].
If it exists, I call a function to write the data to a specific db table, then build+render the form that corresponds to the submit button the user just pressed.
But on certain pages and for certain conditions, drupal resets the form and the $_POST and I can't work out why?
So if I goto page 1, enter some text, then click page 1's button; drupal resets the form
If I fill stuff in in a 'natural' order everything's fine until I get to a group of sub-category forms where drupal resets the form.

The user has to have the choice of filling in whatever data they want, and in whatever order. They also (due to the size of the thing!) need to be able to come back to it at a later date.

Is there anyway to tell the forms api now to reset the form?

I've seen a few posts regarding using $form['#redirect'] = FALSE; but what does it actually do, and would I need to change the way I'm doing things, ie doing the db stuff after rendering the form?

Memorial Module

I'm looking for a memorial type page to use on an alumni site.

I did a search through the current modules and didn't see one currently available. Has anyone heard of such a thing, or implemented one using one of the other modules that are available?

Ken Richards

Image compression module

I mainly share photos on my website, when I first created my online web gallery it took me about 2 hours to prep and upload 20 images. Some of the choirs I had before displaying a new album of pictures included:

  • sorting at least 20 pictures for upload
  • resizing and water marking every picture manually in Photoshop (before I knew about batch process)
  • manually creating thumbnails in Photoshop
  • manually compress saved images in Photoshop to save space
  • manually creating an html page for each image in dream weaver
  • upload via FTP
  • then linking all the pages by hand coding

after switching to Drupal I could create a new album in 20 minutes or less using Drupal modules

  • sorting at least 20 pictures for upload Image Publishing
  • resizing and water marking every picture manually in Photoshop Image Publishing (XP) or image module and image water mark module
  • manually creating thumbnails in PhotoshopImage module
  • manually creating an html page for each image in dream weaver Image module
  • upload via FTP Image Publishing
  • then linking all the pages by hand coding image gallery

The only part of the process that I am unable to do with Drupal is image compression.

I propose a module that would integrate with the image module to add preset image compression levels. I believe the thumbnail feature in image gallery allows you to compress the thumbnails but what I’m proposing is user control on all images uploaded and sorted by type.

Adding new filter in admin/node without changing node.module?

Hello,

I want to create a module which will allow to filter content by whether it is translated into language X or untranslated. I would like to add another radio button into the group 'satus', type, 'category' called 'language'.

Is it possible to append this feature into node/admin without modifying node_filters() and node_build_filter_query() in node.module?

Best regards,

Oleg Mitsura

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions