2

AHAH Repeats Form, not using Divs. Best way to replace?

http://drupal.org

Alright, so I have a very very complex form, that also has its own theme function.

The form has 3 different tables, that all need to be replaced based on an AHAH button callback. And so I decided I should just replace the whole form.

What I am obviously doing wrong : I'm literally replacing the whole <form> tag, because there's no way I can have the whole form under one fieldset or wrapper. There's also no way to set a number of "wrappers" to replace, because I want certain areas of the form renewed from the callback but not everything. FYI: The form has multiple multiple buttons, all going to same callback, and I didn't want to create "multiple callbacks" or install a new module like ahah_helper.
The Problem: When you click the button, everything works perfectly the first time. But in firebug you can see a new <form> is created. Then when you submit again right after---now form_token, form_id and form_build_id are GONE. And you see a big empty form, with empty tables.

<?php
myform(&$form_state, $formid){
// ... form code here, just a number of fieldsets, a number of tables, a number of fields outside fieldsets, this is why I didn't use a div
$form['submitbutton'] = array(
'#type' => 'submit',
'#value' => t('Delete Item'),
'#name' => 'del_my_tabledata',
'#weight' => 5,

read more

Read »
Created by Dplanet 1 year 22 weeks ago
Category: Modules   Tags:

PSD to Drupal Theme

Drupal Development

Module Development

Get an Estimate

Tags for AHAH Repeats Form, not using Divs. Best way to replace?

Recent comments