Welcome Guest, Not a member yet? Register   Sign In
Request: Updated version of Form_validation::is_unique()
#1

(This post was last modified: 09-05-2015, 10:30 AM by jLinux.)

The is_unique() form validation works great if you're creating a new record of whatever, but I ran into a small issue while editing a record.

Lets say you're editing a person and want to the is_unique() on the SSN, the issue I ran into, is the SSN is already going to be there for the user you are editing, so it may be a good idea to allow the user to specify the current value in a format something like table.column:value, then you can use some php and mysql to either ignore that value, or whatever you find suitable.

I know you can just add a new validation check, or edit an existing one, which is what I did here, but I just thought this might be a good feature for CI4

Or.. is there already a feature for this that I totally skipped over, and no one pointed out in the thread I referenced?
Reply
#2

P.S. I can see how there may be some issues with this, seeing as how the "current" value may hold values that would throw the sscanf or a preg_match off, but theres gotta be some way to do it.
Reply
#3

I have adopted the "unique" validation rule from Bonfire into my project. You can check it out here: https://github.com/ci-bonfire/Bonfire/bl...dation.php
Reply




Theme © iAndrew 2016 - Forum software by © MyBB