[horde] problem with Horde_Form_Renderer
fgaloppin at altern.org
fgaloppin at altern.org
Wed Jan 21 00:31:12 PST 2004
I've problem with some code...
This program works right when I don't use the line
$template->set('formulaire', Horde::bufferOutput(array($form, 'renderActive'), $renderer, $vars, '', 'post'));
When I insert it in my code.. I've a white page.
Can anyone say me what I do really bad ? or some docs or any others comments ? :)
define(IGA_BASE, dirname(__FILE__));
require_once IGA_BASE . '/lib/base.php';
$vars = &Horde_Form::getDefaultVars();
$formname = $vars->getVar('formname');
if ($vars->isVarSet('dn')) {
$dn = $vars->getVar('dn');
} else {
$notification->push(_("Aucun utilisateur à supprimer"));
header('Location: ' . Horde::applicationUrl('recherche.php'));
exit;
}
$form = Horde_Form::singleton('', $vars, _("Supprimer"));
$form->_useFormToken = true;
$form->_submit = array(_("Supprimer"), _("Ne pas supprimer"));
$form->addHidden('', 'dn', 'text', true);
$form->addVariable(_("Supprimer cet utilisateur ?"), 'question', 'description', true);
if ($vars->getVar('submitbutton') == _("Supprimer")) {
$form->validate($vars);
if ($form->isValid()) {
$form->getInfo($vars, $info);
$r = $iga->supprime($info['dn'], $notification);
header('Location: ' . Horde::applicationUrl('recherche.php'));
exit;
}
} elseif ($vars->getVar('submitbutton') == _("Ne pas supprimer")) {
$notification->push(_("Entrée non supprimée"), 'horde.message');
header('Location: ' . Horde::applicationUrl('recherche.php'));
exit;
}
$renderer = &new Horde_Form_Renderer();
$template->set('menu', Iga::menu());
$template->set('notify', Horde::bufferOutput(array($notification, 'notify')));
$template->set('formulaire',Horde::bufferOutput(array($form, 'renderActive'), $renderer, $vars, '', 'post'));
require IGA_TEMPLATES . '/common-header.inc';
echo $template->fetch(IGA_TEMPLATES . '/supprime/supprime.inc');
require IGA_TEMPLATES . '/common-footer.inc';
?>
I've that in my common-header.inc :
<html>
<head>
<?php
echo Horde::stylesheetLink(Horde::getThemeConfig(), 'iga');
?>
</head>
<body>
and that in my supprime.inc :
<table border="0" cellpadding="2" cellspacing="0" width="100%">
<tr><td class="menu"><table border="0" width="100%"><tr>
<loop:menu> <tag:menu /> </loop:menu>
<td width="100%"> </td><!-- spacer -->
</tr></table></td></tr></table><br />
<tag:notify />
<tag:formulaire />
I don't understand why there is nothing on my page except if I comment the line :
$template->set('formulaire',Horde::bufferOutput(array($form, 'renderActive'), $renderer, $vars, '', 'post'));
Thx in advance
Galoppin Fabian
fgaloppin at altern.org
More information about the horde
mailing list