php-bootstrap-form icon indicating copy to clipboard operation
php-bootstrap-form copied to clipboard

Using with Templates

Open Omegatcu opened this issue 8 years ago • 1 comments

Hello and thank you for your work.

Is it possible to save the whole form in a Variable so i can send the output to a Template like Twig or Smarty?

Omegatcu avatar Jun 02 '16 09:06 Omegatcu

Hello.

I have the same problem.

I use this workaround :

<?php

public static function getForm()
{
    ob_start();
    \Form::open("user", $_POST, ['view' => "SideBySide"]);
    \Form::Hidden("Id");
    \Form::Hidden('form', 'user');
    \Form::TextBox(gettext("Nom") . " : ", "nom", array("required" => 1));
    \Form::TextBox(gettext("Prenom") . " : ", "prenom", array("required" => 1));
    \Form::Button(gettext("Enregistrer"));
    \Form::Button(gettext("Annuler"), "button");
    \Form::close(false);
    $form = ob_get_contents();
    ob_end_clean();
    return $form;
}

?>

julienbohy avatar Sep 12 '16 12:09 julienbohy