[support] dinamic form id

Ámon Tamás amont at 5net.hu
Tue Jun 10 15:12:49 UTC 2008


Hello,

I have a lot of dynamical generated forms in one page. Every form is a 
block and I used panels module to put these to one page.  Depend on the 
$delta I made different forms.

Some code:
function qqplast_block($op = 'list', $delta='0', $edit=array()) {
 $blocks = array('a lot of arrays not interesting');
  switch($op) {
      case 'list':
        return $blocks;
      case 'view':
        $block['subject'] = $blocks[$delta]['title'];
           $block['content'] = drupal_get_form('qqplast_altalanos', $delta);
         return $block;
    }
}
function qqplast_altalanos($delta) {
    $form=array();
    $form["delta"] = array(
      "#type" => "hidden",
      "#value" => $delta
    );
    $form['ertekek_'.$delta] = array(
      "#type" => "checkboxes",
      "#options" => $anyagnevek[$delta],
      "#default_value" =>''
    );
    $form['lekerd_tipus'] = array(
      "#type" => "select",
      "#options" => _qqplast_get_lekerdezes_tipus($delta)
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
    $form['#submit'] = array('qqplast_altalanos_submit' => array());
    return $form;
 }

The only difference is the checkboxes. My problem is the $form_id is 
always the same. How can I change it dynamically?


Thanks

Ámon Tamás
Sitefejlesztő és programozó
-- 
5NET Informatikai Kft.
1062 Budapest, Aradi utca 38. A 3/11
telefon: (1) 461-0205  |  fax: (1) 461-0206
e-mail: amont at 5net.hu  |  web: http://www.5net.hu 



More information about the support mailing list