Home » Php » Fastest way to build form – PHP/jQuery/CodeIgniter

Fastest way to build form – PHP/jQuery/CodeIgniter

Posted by: admin July 12, 2020 Leave a comment


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?

How to&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:

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"


// Or to load the form definition via AJAX


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.


None of these are, in my opinion, entirely satisfactory solutions, but they might work for you:

http://formigniter.org/app/ (Online generation tool)

http://formtorch.geekhut.org/ (Online generation tool, includes javascript)

http://www.frankmichel.com/formgenlib/user_guide/introduction/getting_started.html (CI library)

http://www.getfuelcms.com/user_guide/libraries/form_builder (Part of CI-based Fuel CMS)


@dave I’ve been using CI for a while now, and generally speaking using its built in form support or doing it home brew is really no different. Personally I tend to lean towards home brew handwritten forms in a matter of speaking. Avoiding CI’s form support all together. Although CI does offer “ease” of use so to speak for more novice users (and the gurus alike). I’ve always felt the same as you, its got a kind of restrictive feeling to it, top it all off when your making forms for CI using there system for it your basically doing the same thing as you would with standard HTML but also implementing in CI’s syntax so it can handle it better. For me I do a lot of AJAX related stuff so the standard support doesn’t help me much and usually gets in the way. I’ve worked on a few Professional level teams as well which have used CI as the backend framework but also share the same distaste for the form support CI has. More times then less its gotten in the way of development on both the front and back end then it has done any good.

More times then less we would always end up going the route of standard HTML forms and just work with the standard PHP means of getting the posted data and then home brewing our own filters on an element to element need so we know we are getting what data we want to get without having to come up with some means of getting around any restrictions otherwise.

So the short version to your answer is just go with standard html/php form handling. You will find a lot more support out there how to handle your inputs stand alone that way opposed to CI (matter of opinion). Also handling your forms this way doesn’t muck up the works you can still easily work within CI with its other lib’s and mod’s

I know this isn’t a direct answer to your question but I felt I should at least put my 2 cents in. CI is a nice framework all around but its built on PHP so if you can do it with PHP you can do it within CI, and in the event of form handling I go the route of PHP rather than work with CI


I use CodeIgnitor but I just created my own validation class – you have more flexibility and scope by doing it yourself and saves more time…that’s what I find anyways.

I just narrowed it down so a method takes in an array of inputs, and just loops through and check’s their not empty and returns an array of the missing, if the field is in the missing array highlight it or do whatever the design is going with. Simples.

As for codeIgnitor validation, i’ve never felt like I needed to use it.