Cannot add subform

claudiu.cristea - November 17, 2008 - 14:31
Project:AHAH Forms Framework
Version:5.x-1.5-5
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

I'm trying to add a subform on a form by using the dynamic_subform module. Hereţs the example:

<?php
function test_form() {
 
$form['some_text'] = array(
   
'#type'   =>  'textfield',
   
'#title'  =>  t('Some text'),
  );
 
$form['button'] = array(
   
'#type'   =>  'submit',
   
'#value'  =>  t('Show subform'),
   
'#ahah_bindings'  =>  array(
      array(
       
'event'     => 'click',
       
'wrapper'   => 'subform_div',
       
'path'      => 'subform/add',
      ),
    ),
  );
 
$form['wrapper'] = array(
   
'#value' =>  '<div id="subform_div"></div>',
  );
  return
$form;
}

function
test_subform() {
 
$form['other_text'] = array(
   
'#type'   =>  'textfield',
   
'#title'  =>  t('Other text'),
  );
  return
$form;
}

function
test_subform_add() {
 
$items = dynamic_subform_get_prepped('test_form', 'test_subform', NULL);
  print
theme('status_messages') . drupal_render($items);
}
?>

Of course subform/add is handled by test_subform_add().

I got error:

No cached subform_build_id! : Can not find old cached args : Bad subform_id in args - vs test_subform

What is wrong in my implementation?

Thank you,
Claudiu

#1

starbow - July 21, 2009 - 21:53
Status:active» closed
 
 

Drupal is a registered trademark of Dries Buytaert.