[support] Form submission problem

Metzler, David metzlerd at evergreen.edu
Fri Feb 1 16:24:09 UTC 2013


If you're willing to post your form and form_submit handler code, I'd be willing to take a look at it (or contact my via drupal contact form).

Again, if what you say is true (the form is rendering but the submit handler is not executing and they are in the same file). I think we can safely assume your include file is in fact being loaded. Any tweaks to that are futile.

By the way, if the hook_nood_view is in the same module as the form's include file, using

require_once 'mymodule.pages.inc' ;

Is quite adequate.  Using all the drupal get path and stuff is only necessary if you are loading code from a different module.

Dave

________________________________
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On Behalf Of Ms. Nancy Wichmann
Sent: Friday, February 01, 2013 6:24 AM
To: support at drupal.org
Subject: Re: [support] Form submission problem

Thanks, Hans. That was a new one to me, as a lot of D7 stuff is. But it didn't solve the problem. Oh well.


Nancy

________________________________
From: Hans Langouche
I'm starting to believe that the problem is that the #submit handler is not wired correctly to  this form. If require_once  failed it would throw a hard error and no form would render.  This means that the function that the form handler thinks is the submit handler is not the same as the one you think it is. I think the include is not the problem or the form wouldn't render.

Is it possible that something is overriding the submit handler.  #submit attributes on the form in drupal 7 might do that.

Are you using 6 or 7?

$form_state['rebuild'] sets in the validation handler might cause this.
$form_state['storage'] sets in the validation handler in D6 might also cause this.

Dave

________________________________
From: support-bounces at drupal.org<mailto:support-bounces at drupal.org> [mailto:support-bounces at drupal.org<mailto:support-bounces at drupal.org>] On Behalf Of Ms. Nancy Wichmann
Sent: Thursday, January 31, 2013 4:49 PM
To: support at drupal.org<mailto:support at drupal.org>
Subject: Re: [support] Form submission problem

In hook_node_view(), I have:
  require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'mymodule') . '/mymodule.pages.inc';
  $form = drupal_get_form('mymodule_tab_form', $node, $mymodule->wid, $states, $current);
  $form['#weight'] = 99;

  $node->content['mymodule'] = $form;
I'm guessing that this technically makes the form part of the main module, while the submission handler is still in the .inc file.

BTW, I even tried adding the .inc file name to the .info file. No help.


Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.

________________________________
From: Earnie Boyd <earnie at users.sourceforge.net<mailto:earnie at users.sourceforge.net>>
To: support at drupal.org<mailto:support at drupal.org>
Sent: Thursday, January 31, 2013 1:35 PM
Subject: Re: [support] Form submission problem

On Thu, Jan 31, 2013 at 12:27 PM, Ms. Nancy Wichmann wrote:
> In a module, I am using drupal_get_form() to load a form from a .inc file.
> That works fine. But when it is submitted, the submission handler can't be
> found; it's also in the .inc file. How do I get around this?

Uh, I thought that was how it should be done.  Can you give us a mock
up of your form and menu item?

--
Earnie
-- https://sites.google.com/site/earnieboyd
--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20130201/3d7c21c3/attachment-0001.html 


More information about the support mailing list