Hello, I made a multi-page form with the ctools wizard and it works very well.
Now i want to implement some form fields (textfields with autocomplete) within this page which should be ahah driven in that way, that you can press the "add more" button and another field appears.
I managed to do a spearate for with this multiple fields, and it works but if i want to merge these two problems i stuck.
Because in my callback function i dont know how to pass the required arrays - for example the form i try to get from the cache does not have a key #parameters and so on.
Now i try to get these information with
$form_state = array('storage' => NULL, 'submitted' => FALSE);
$form_build_id = $_POST['form_build_id'];
$form = form_get_cache($form_build_id, $form_state);
$args = $form['#parameters'];
but i guess i have to go another way, because the ctools - cache is used and so on...
Can someone give me a push in the right direction ?
Felix
Comments
Comment #1
merlinofchaos commentedYou probably don't want to use #ahah at all, since that relies on cached forms and that's probably not a good way to go.
Instead what you want to do is use add the ctools-use-ajax class to the button you want, which will cause the form to submit for that button. When the form submits, it can go to the proper submit class for that form, make the changes it needs to make (and store them in cache -- for example, store how many fields you have) and then send the form or part of the form back via a ctools_ajax_render() command.
I realize the above is a very short description of what you have to do. I hope it helps.
Comment #2
merlinofchaos commented