• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Form Validation

#1
I'm not too happy with the form validation call back function, and it feels as if I'm working against it for some specific cases.

Let's say I have four $_POST fields...

But I want to validate if it is valid by passing ALL four into a function and determining if it is good or not.

Can I do this?

At the moment each post field has a callback function.

I would like so that you pass all four into one function, and then if failed repopulate the form.

I can't think of a way around this so I am probably mis-using the flash data to achieve this.

Any pointers most welcomed.
Practical guide to IgnitedCMS - Book coming soon
Reply

#2
(10-01-2015, 12:17 PM)iamthwee Wrote: I'm not too happy with the form validation call back function, and it feels as if I'm working against it for some specific cases.

Let's say I have four $_POST fields...

But I want to validate if it is valid by passing ALL four into a function and determining if it is good or not.

Can I do this?

At the moment each post field has a callback function.

I would like so that you pass all four into one function, and then if failed repopulate the form.

I can't think of a way around this so I am probably mis-using the flash data to achieve this.

Any pointers most welcomed.

You can use array as field names: http://www.codeigniter.com/user_guide/li...ield-names

Or

this: http://www.codeigniter.com/user_guide/li...-than-post

with callbacks work fine.

Reply

#3
Thanks the set_data() looks like what I need if I can pass a callback function to it with all four variables.

Will investigate tomorrow.
Practical guide to IgnitedCMS - Book coming soon
Reply

#4
me too here, but using array for call bagk is the best way to minimize time to coding even never tested,
Reply

#5
https://github.com/bcit-ci/CodeIgniter/issues/193
Reply

#6
Thanks looks like I'll have to stick with using my hacked flash data method Sad
Practical guide to IgnitedCMS - Book coming soon
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.