0

In the following snippet, the form returned has only the hidden values. No name, email, or comment.

require_once drupal_get_path('module', 'contact') .'/contact.pages.inc';
$elements = drupal_get_form(array('contact_site_form'));
$form = drupal_render($elements);

Can anyone say why $form is not returning an HTML form?

6
  • Maybe because drupal_get_form returns an html representation of whatever form is passed in the argument. Nov 30, 2011 at 19:30
  • I meant to ask, why is this NOT returning a html string? (oops, my cred is falling faster than some presidential candidates!)
    – Joe Hyde
    Dec 1, 2011 at 0:18
  • Are you using D7 or D6? Dec 1, 2011 at 5:56
  • This is Drupal 7, and it suddenly started working. Weird ass Drupal (-;
    – Joe Hyde
    Dec 12, 2011 at 22:20
  • @stefgosselin drupal_get_form does not return html, it returns the form array.
    – forest
    Sep 8, 2012 at 15:57

1 Answer 1

4
drupal_get_form('contact_site_form');

Not the answer you're looking for? Browse other questions tagged or ask your own question.