Welcome Guest, Not a member yet? Register   Sign In
Multiple ignore-fields for is_unique-function
#2

(This post was last modified: 10-28-2020, 06:57 PM by mlurie.)

I'm not sure I am interpreting your question correctly, but in general, if you need two fields to be unique, you will need to create a separate validation rule for each field.

If you are trying to check if the value of the field is unique in two different columns in the same row (I'm not sure why you would ever want to do this) try using the is_unique rule twice, once for each column.  I've never done it before, but it might work.


PHP Code:
'rules' => 'required|max_length[100]|is_unique[table.column1,table.columnID,{columnID}|is_unique[table.column2,table.columnID,{columnID}]'

Please note the correct syntax for the ignore value placeholder described in the documentation: https://codeigniter.com/user_guide/libra...aceholders.

If that doesn't work, you will need to create your own custom validation rule. Check out the documentation to get started: https://codeigniter.com/user_guide/libra...stom-rules.
Reply


Messages In This Thread
RE: Multiple ignore-fields for is_unique-function - by mlurie - 10-28-2020, 06:02 PM



Theme © iAndrew 2016 - Forum software by © MyBB