I have an entityform that appears on a page, for some reason the form will not submit ...
// implement hook_menu
function foiagen_menu() {
$items['node/%node/foiagen'] = array(
'title' => 'Foia Generator',
'description' => 'A foia generator form.',
'page callback' => 'drupal_get_form',
'page arguments' => array('foiagen_form', 1),
'access callback' => TRUE,
);
return $items;
}
// embed the form (it's an entityform).
function foiagen_form($form, &$form_state) {
module_load_include('inc', 'entityform', 'entityform.admin');
$entity_form_name = 'foia_generator';
$render_estimate_form =
entityform_form_wrapper(entityform_empty_load($entity_form_name), 'submit', 'embedded');
$form['foiagen'] = $render_estimate_form;
return $form;
}
function foiagen_form_validate($form, &$form_state) {
}
function foiagen_form_submit($form, &$form_state) {
}
I have tried to wrap my head around this solution but cannot figure out where, once my form is rendered, filled and the submit button pressed the 'update' occurs that makes the input void...
I have seen the comment here and tried adding
$form['#token'] = NULL;
to my 'function foiagen_form' that does circumvent the 'The form has become outdated.' error but leads to a blank page. Indicating that perhaps something else altogether is malfunctioning.
following direction from answer came up with this:
function foia_generator_form($form, &$form_state) {
form_load_include($form_state, 'inc', 'entityform', 'entityform.admin');
$entityform = entity_create('entityform', array(
'type' => "foia_generator",
));
$form = entityform_form_wrapper($entityform);
return $form;
}
module_load_include()
you should useform_load_include()
from a form constructor. (Not sure if that's actually a fix to the problem tho...)