Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Smarty manage forms

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
pk86
Smarty n00b


Joined: 14 Jan 2011
Posts: 4

PostPosted: Sun Mar 05, 2017 11:02 am    Post subject: Smarty manage forms Reply with quote

Hi all, i have a simply (I hope) question, but i can't find a response.

I need a method for manage a custom fields for a form, i don't known if there is an existing plugin, or i should create it for me.

For example, i want manage a boostrap fields. A best practies for me can be:

In php file:
Code:

$inputs->addForm('text', 'name', 'example');
$inputs->addForm('text', 'name2', 'example2');
$inputs->addForm('text', 'name3', 'example3');
$smarty->assign('input_form', $inputs);


In tpl file:
Code:

<form action="./insert.php" method="post">
{$input_form}
</form>


And i want to generate this in HTML:
Code:

<form action="./insert.php" method="post">
<div class="form-group">
    <label for="name">name</label>
    <input class="form-control" id="name" name="name" value="example">
</div>
<div class="form-group">
    <label for="name2">name2</label>
    <input class="form-control" id="nam2e" name="name2" value="example2">
</div>
<div class="form-group">
    <label for="name3">name3</label>
    <input class="form-control" id="name3" name="name3" value="example3">
</div>
</form>


Thanks & regards
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun Mar 05, 2017 12:28 pm    Post subject: Reply with quote

__toString() ?
Back to top
View user's profile Send private message
pk86
Smarty n00b


Joined: 14 Jan 2011
Posts: 4

PostPosted: Sun Mar 05, 2017 12:58 pm    Post subject: Reply with quote

What do you mean? A single class for each input type?
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Sun Mar 05, 2017 4:31 pm    Post subject: Reply with quote

A class for each form.
Back to top
View user's profile Send private message
pk86
Smarty n00b


Joined: 14 Jan 2011
Posts: 4

PostPosted: Sat Mar 18, 2017 8:20 am    Post subject: Reply with quote

Thanks.
I've created one class for each input type (that have html code) and after one class for each form (that include necessary form type)
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP