Welcome Guest, Not a member yet? Register   Sign In
Problem with validation an unique field
#1

[eluser]Mr.SoOoMa[/eluser]
Hello there ..

I use the form validation library to validate my fields in a form .. but i have a problem with unique field ..

I have a table for "Clients" and every table has email field, and i need the email to be unique ..

in (add client) form i have no problem to put rules like this :

Code:
$this->form_validation->set_rules('email', 'lang:email', 'required|valid_email|is_unique[clients.email]');

and the input is :

Code:
<input type="text" name="email" size="50" value="{set_value('email')}" />

till now, i have no problem, but my problem is in (edit client) form .

when i edit a client i select all of fields from database and i put each one in the form like this :

Code:
<input type="text" name="email" size="50" value="{$client.email}" />

if the user edited the value it will update, if not the form will replace the old value with the same value.

my problem is, when i put the rule (is_unique), the user can't put the same email and save "actually he won't change the email Smile" ..

and if i don't put the rule (is_unique), the user can register a new client with unique email, and edit it later with non unique email, it's a bug of course Big Grin

what should i do in that ?


Messages In This Thread
Problem with validation an unique field - by El Forum - 09-11-2012, 03:54 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 03:58 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:27 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:34 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:42 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:44 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:46 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:48 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 04:59 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 05:01 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 05:03 PM
Problem with validation an unique field - by El Forum - 09-11-2012, 05:11 PM
Problem with validation an unique field - by El Forum - 12-28-2012, 06:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB