Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Fieldset::build - using in views
MaxG
August 2013
Hey,
When i try to use:
(...)
$login_form = Fieldset::forge();
$login_form->add('username', '', array('placeholder' => 'Benutzername oder E-Mail Adresse'), array('required'));
$login_form->add('password', '', array('placeholder' => 'Kennwort'), array('required'));
$login_form->add(Config::get('security.csrf_token_key'), Security::fetch_token(), array('type' => 'hidden'), array('required'));
$login_form->add('submit', '', array('type' => 'submit', 'value' => 'Anmelden'));
$data['page_data'] = array('login_form' => $login_form->form()->build());
(...)
And i print it out in the view using:
(...)
<?php echo $page_data['login_form']; ?>
(...)
...I just get the plain HTML-Code and not the Form directly...
look here:
http://speedcap.net/sharing/screen.php?id=files/ca/f4/caf423f12daf07e01c58aaf0f9d189d4.png
Hope you can help me!
Greez
:-)
Harro
August 2013
Accepted Answer
FuelPHP encodes on output, all data you send from the controller to the view will be encoded for security reasons.
If you don't want that, you have to send that variable to the view unencoded, using the set_safe() method, or using false as third parameter to set().
$view->set('login_form', $login_form->form()->build(), false)
and then in your view
<?php echo $login_form; ?>
MaxG
August 2013
Okay! Thank you, it works perfect!!! Is it possible to render the form without an table?
Greez
Syntaxlb
August 2013
Accepted Answer
Hi,
You can customize your form template in config/form.php
Harro
August 2013
Accepted Answer
to be complete: copy the default from fuel/core/config to app/config, then customize it.
MaxG
August 2013
Thank you! Great community here just waited 2 minutes
:-D
Greez
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
August 2013
MaxG
August 2013
Syntaxlb
August 2013