[gelöst]Formular holen in einer anderen Funktion
am 11.01.2012 - 10:51 Uhr in
Ich habe ein Form mit einem textfeld und einem submitbutton.
in einer anderen Funktion möchte ich dieses Formular aufrufen. Schlussentlich will ich ein Form ausgeben und Teile der funktion
wie kann ich dies am besten Realisieren?
mein Form:
<?php
function product_search_form($form, &$form_state){
$form = array();
$form['serach'] = array(
'#type' => 'textfield',
'#title' => 'Search',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Go'
);
return $form;
}
?>Teils der Funktion:
<?php
function product_category_list() {
$form_id = 'product_search_form';
$output = "";
$get_search_form = drupal_get_form($form_id); // holt mir das ganze form heraus (array)
$output .= $get_search_form;
?>- Anmelden oder Registrieren um Kommentare zu schreiben

Konnte gelöst werden. ich
am 11.01.2012 - 11:28 Uhr
Konnte gelöst werden. ich habe nach drupal_render_form() gesucht dabei ist es nur drupal_render()
code der beiden Funktionen:
<?phpfunction product_category_list() {
$form_id = 'product_search_form';
$output = "";
$get_search_form = drupal_get_form($form_id);
$output .= drupal_render($get_search_form);
?>
das formular:
<?php
function product_search_form($form, &$form_state){
$form = array();
$form['serach'] = array(
'#type' => 'textfield',
'#title' => 'Search',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Go'
);
return $form;
}
?>