Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fastest way to build form - PHP/jQuery/CodeIgniter

There are tons of ways to handle forms in general, but I'm wondering if anyone has a solid solution that they use for almost all of their apps, something can build out forms quickly and include all types of form elements.

What I'm currently using is simply CI's built-in form validation and then building out a form, but even with this, I feel like it takes too long... any suggestions?

like image 528
dzm Avatar asked May 11 '11 01:05

dzm


2 Answers

There is a jQuery plugin (called "dform") which take JSON input to build a form dynamically. I have been using this for a while now.

Please take a look at the following URL:
http://neyeon.com/p/jquery.dform/doc/files2/readme-txt.html

Quick Usage:

var formdata =
{
"action" : "index.html",
"method" : "get",
"elements" :
[
    {
        "name" : "textfield",
        "label" : "Label for textfield",
        "type" : "text",
        "value" : "Hello world"
    },
    {
        "type" : "submit",
        "value" : "Submit"
    }
]
};

$("#myform").buildForm(formdata);

// Or to load the form definition via AJAX
$("#myform").buildForm("http://example.com/myform.json");
like image 194
Rakesh Sankar Avatar answered Oct 28 '22 14:10

Rakesh Sankar


https://github.com/zwacky/codeigniter_form_builder - is a form builder library for codeigniter. it has an extensive how to page and should be easy to use.

like image 38
Simon Wicki Avatar answered Oct 28 '22 15:10

Simon Wicki