my_module/form at which you can access the form ) and how a form is defined containing a textfield?
$item['/newpage'] = array(
'title' = t('My new page'),
'page callback' => 'drupal_get_form',
'page arguments' => array('mymodule_test_form'),
);
Tells Drupal to create a new url location at /newpage, call drupal_get_form to generate the HTML for the 'mymodule_test_form' that I defined.
$item['/newpage'] = array(
'title' = t('My new page'),
'page callback' => 'mymodule_test_page',
);
browsing to mysite.com/newpage just calls the mymodule_test_page() function to figure out what to do. In that function, I can choose to generate some HTML and return that to the browser (including my test_form HTML):
function mymodule_test_page() {
$output = "Some HTML Text";
$output .= drupal_get_form(mymodule_test_form);
$output .= "Some closing text.";
return $output;
}
And voila! You inserted your form into another separate HTML page. If you are wanting to insert a form into content that is programmatically generated by another module or by core, then that can be trickier.You are not logged in, either login or create an account to post comments
posted by advicepig at 12:35 PM on March 4