Welcome Guest, Not a member yet? Register   Sign In
CI4 Form Builder Lib
#1

Hi there,

I developed a lib called "Ci4FormBuilder", which helps to create forms (and their components) in an object-oriented way. The repository and documentation can be accessed at the following link.

https://github.com/rafaelwendel/CI4FormBuilder

Suggestions are welcome!
Reply
#2

Good news, thanks for sharing.
Reply
#3

I think this approach complicates the work with forms. In fact, this is a wrapper over helpers.
Does this solution have any advantage?
Reply
#4

(06-24-2023, 05:45 PM)iRedds Wrote: I think this approach complicates the work with forms. In fact, this is a wrapper over helpers.
Does this solution have any advantage?

Hello IRedds,

I developed this lib for a personal project, and it helped me in aspects like:

- Define (or edit) the forms template and its components in an easier way, like before and after <form> tag (to add for example an alert with success/error message of a submit), before and after each field, styles of message validation errors, ...
- Easy to set the field structure (with its label, and inside a "<div>"). If necessary, I change the template and all fields will be changed (or each field can be its own template)
- Set the field values just by passing
PHP Code:
$this->request->getPost() 
or a model response (Like
PHP Code:
$userModel->find(1
)
- Just set
PHP Code:
$validation->getErrors() 
to display the validation error message in their respective fields.


Anyway. I hope it can be an a good alternative!

Thanks!
Reply
#5

Thank you for sharing!

This is an OOP way to build forms.
It would help coding when we don't like to write HTML forms in Views.
Reply
#6

But the same can be done in a simple template with helpers.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB