CodeIgniter Forums
[split] Model bindable template? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: [split] Model bindable template? (/thread-65843.html)



[split] Model bindable template? - prezire - 07-30-2016

Creating a form with repetitive names is a pain:
PHP Code:
echo form_open('user/update'),
 
 form_input('full_name'set_value('full_name'$user->full_name), array('id' => 'full-name''class' => 'full-name')),
 
 form_input('email'set_value('email'$user->email), array('id' => 'email''class' => 'email')),
 
 form_input('password'set_value('password'$user->password), array('id' => 'password''class' => 'password')),
form_close(); 

No plans making a model-bindable form? I implemented a different structure in CI3 right now but the goal is to implement something like this:
PHP Code:
echo bindable_form_open($user'user/update'),
 
 //The key also generates both ID and class names.
 
 form_input('full_name'),
 
 form_input('email'),
 
 form_input('password'),
bindable_form_close(); 

It would be nice if CI4 has a template engine with these features.


RE: [split] Model bindable template? - kilishan - 07-31-2016

This is not currently in the plans to implement.


RE: [split] Model bindable template? - prezire - 08-01-2016

(07-31-2016, 07:38 PM)kilishan Wrote: This is not currently in the plans to implement.

I hope this gets integrated. It's useful for CREATE and UPDATE page forms:

Code:
<!-- users/create.php -->
<div id="user" class="create">
  echo bindable_form_open(null, 'user/create'),
             view('users/_form'),
         bindable_form_close();
</div>

<!-- users/update.php -->
<div id="user" class="update">
  echo bindable_form_open($user, 'user/update'),
             view('users/_form'),
         bindable_form_close();
</div>