multi Validation

331 views
Skip to first unread message

TheSin

unread,
Aug 15, 2013, 3:16:43 PM8/15/13
to php-form-bu...@googlegroups.com
Just wondering if I can do multi validation some how, I haven't really looked deep into it yet honestly, but I'd like to do something like

'validation'    => array(
new PFBC\Validation\AlphaNumeric,
new PFBC\Validation\RegExp("/blah/")
)

or something of the sort, I know you might say just add the alpha to the regex, but bare in mind this is just an example, I'm actually planing to write an ajax validation, so I'd like the alphanumeric and the ajax to both need to pass.  Thought I'd post here before I put too much into it.

Andrew Porterfield

unread,
Aug 15, 2013, 3:29:28 PM8/15/13
to php-form-bu...@googlegroups.com
Yep, you can apply multiple validation rules to the same element - either by passing an array as you've done below. Have a look at the setValidation method at https://code.google.com/p/php-form-builder-class/source/browse/trunk/PFBC/Element.php.
> --
> You received this message because you are subscribed to the Google Groups "php-form-builder-class" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to php-form-builder-...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

TheSin

unread,
Aug 15, 2013, 3:30:42 PM8/15/13
to php-form-bu...@googlegroups.com
Excellent, I'll get to work on my Ajax Validation method and test it out right away.  I'll post it here once done.

TheSin

unread,
Aug 16, 2013, 11:14:24 AM8/16/13
to php-form-bu...@googlegroups.com

I got it all working thank you, sadly without my other patches from before for JS validation I can't share my ajax validation since it all relies on the other patch.  If you want my js validation code I can zip up my current PFBC and send it to you directly, it works really well and it nice to have on the fly validation.  It still does physical checks after submit too as a precaution which means you can enable or disable the js validation part as well.  Anyhow let me know and thanks again I love this framework and multi validation + ajax validation is awesome!

Nic

unread,
Mar 31, 2014, 5:45:25 PM3/31/14
to php-form-bu...@googlegroups.com
TheSin, I would love to try out your multi validation code.   Can you send it to me or post it somewhere that is publicly accessible?   Google drive link?

Alexander Butenko

unread,
Oct 22, 2015, 10:01:34 AM10/22/15
to php-bootstrap-form
Hello,

If you dont mind, you can now send pull requests of you want to get your code into a new version.
https://github.com/avbdr/php-bootstrap-form

Thank you,
Alex
Reply all
Reply to author
Forward
0 new messages