CodeIgniter Forums
Form Generation Library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Form Generation Library (/showthread.php?tid=16439)



Form Generation Library - El Forum - 08-06-2009

[eluser]pysco68[/eluser]
yup...

but in time i found where the problem is... the user-defined callbacks have to be in the actual controller :S that's rather ugly for a libary... so i'm trying to extend the validation class (ugly too *sad*)... if you got any idea, drop me a line...

Greetz Wink


Form Generation Library - El Forum - 08-06-2009

[eluser]pysco68[/eluser]
Edit:

Quote:good news: it's nearly ok... bad new, there's still one bug: when the validation fails, the system outputs:

Quote:- Unable to access an error message corresponding to your field name.

Into the error message zone you defined. But I duno why nor how to get rid of this...
Could you take a look at this??

I think it's rather finished and usable now, but there are rather ugly hacks:
- one because of the impossibility to declare a validation callback IN a controller... so I was obliged to move it into a MY_Form_validation.php (core extention)... a sad consequence's I haven't found any proper way to get the reCAPTCHA response message (derailed error) back, so there is only TRUE/FALSE....
- The original form_validation lang file has no entry for the new field type I created (recaptcha), so we have to manually declare the error message...

But bad things apart, it's usable:
Code:
$form = new Form();
        
        $form
            ->open('recaptcha_demo')
            ->text('username','Your Username','required|trim|alpha_numeric|max_length[30]|xss_clean')
            /*
             * That's the interesting part ;) simple reCAPTCHA integration!
             *
             * just write $form->recaptcha('Title of the label') and set the error_message() to what you want!
             * We have to set this message because there's no matching entry in the form-validation file for field-type "recaptcha"....
            */            
            ->recaptcha('Are you human?')
            ->error_message('Are you really human?? Copy the right text on the image below!')
            /* That's all in here ;) */
            ->submit()
            ->reset()
            ->validate();

is enough to get the form that's shown as screenshot...

I hope this little contribution get his way into your library, and anyone else is free to use it!

Thanks to Jon Trelfa for his original reCAPTCHA plugin for CI! It's the base of much of the code...

Good evening,
Pysco68


Form Generation Library - El Forum - 08-07-2009

[eluser]macigniter[/eluser]
hey i am on my way to the netherlands for a weekend vacation. i'll look into your addition first thing next week and get back to you then.

cheers!


Form Generation Library - El Forum - 08-07-2009

[eluser]Unknown[/eluser]
@macigniter
VERY sweet library. I'm eager to start working with it. Looking to rewrite my current non-framework web app with CI. Yes, I'm a CI noob! Smile I've looked at a number of frameworks and seem to keep coming back to CI.
Also, any thoughts of making a wizard style next-prev ability with multiple forms? Still looking to see how I can best recreate a desktop app we have that desperately needs rewriting (my pref would be web based).

@Robert May
Any update on that sweet code you talked about writing regarding database-created forms? I've got an desktop app that has a form builder that I'd love to rewrite in CI. Not sure if I want to tackle such a massive job, but I love a challenge.


Form Generation Library - El Forum - 08-09-2009

[eluser]macigniter[/eluser]
@pysco68: back from holland. just played around with your files and managed to get rid of the additional MY_Form_validation.php file. Everything is included in the single form library now. I will add the code to the next version of the library and clean it up a little if that's okay with you. Of course I'll add your name to the credentials in the user guide! Smile Thanks again!

oh and by the way... my implementation makes it possible to get the response message back and use it...


Form Generation Library - El Forum - 08-09-2009

[eluser]pysco68[/eluser]
great!!

Hope I get the clue of how you get rid of that MY_sh*t out of your file (or could you shortly explain it to me [PM?]) for the rest I'm ok with that Wink thank you very much for the credit Wink

Good evening,
Pysco68


Form Generation Library - El Forum - 08-13-2009

[eluser]macigniter[/eluser]
hi everybody!

a new version (0.1.5) of the library is out. there are quite some changes to the lib which would've made this release a perfect candidate for 0.2.0. but i realized that after updating all the files and zipping them up. so i just won't worry and increase the version number next time Smile

anyway, here are the updates:
- thanks to Yannic "Pysco68" Staudt I integrated the reCAPTCHA into the library. there's no need for another file. everything is handled by the lib and config file. check it out!
- a big change has occured in the config file. i have changed the way the config file is set up to match the CI standards. for all of you that are updating to this version DON'T FORGET to update your config files!!

Everything else can be found in the changelog in the user guide. Have fun with the library and happy recaptchaing Wink

PS: for those of you using the recaptcha element, don't forget to include the language file. this is where you can also add more error messages based on the reCAPTCHA API.


Form Generation Library - El Forum - 08-13-2009

[eluser]pysco68[/eluser]
Just looked into it,

truly better now Wink I'll remember for the next element to add lol
Thanks for the credits too!

My auth library is on it's way... at the time I'm getting arround with the session deal... I'm not certain if the auto-loggin function(s) will be in the first release....

Thank you for the great tool anyway.

Best regards, Pysco68


Form Generation Library - El Forum - 08-13-2009

[eluser]got 2 doodle[/eluser]
@macigniter - great news, I'll check it out
@psyco68 - looking forward to your auth lib, keep us posted

doodle


Form Generation Library - El Forum - 08-13-2009

[eluser]macigniter[/eluser]
I just further improved the source code to validate the output as XHTML 1.0 Transitional when the reCAPTCHA element is being used in a form. I have already updated the demo form on my website. Check it out and validate it Smile

I will include these minor updates with the next version of the lib.