Already exist

Already exist

michelekmichelek Posts: 24Questions: 5Answers: 0

I'm working on my project http://accoglienza.eservers.it/join.html

When I am creating a new entry I have to check if name and surname already exist, how I can do it?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    Hi,

    With a single field you would be able to use the unique validator that is built into Editor. However, with it being the combination of two fields, you would need to write a custom validation method.

    Allan

  • michelekmichelek Posts: 24Questions: 5Answers: 0
    edited November 2015

    I don't know how to validate both columns with an AND operator

    example: if persone.nome AND persone.cognome is unique

    Field::inst( 'persone.nome' ),
    Field::inst( 'persone.cognome' ),
        ->validator( 'Validate::unique', array('required'=>true,'message'=>'duplicated')),
    
  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin

    You need to write a custom validator, detailed which you can find at the link I gave above. As I say, there isn't a built in validator that will check the uniqueness of two values combined.

    Allan

  • michelekmichelek Posts: 24Questions: 5Answers: 0
    edited November 2015

    I really don't know how to do it, I need an example to understand.

    Can you do it for me, I can pay your service.
    If I can deal directly with you write me an email to info@eservers.it

  • allanallan Posts: 63,760Questions: 1Answers: 10,510 Site admin
    Answer ✓

    Certainly - I'd be happy to write an example of this under the DataTables support options. The Quick Support 60 option would cover it.

    Regards,
    Allan

  • michelekmichelek Posts: 24Questions: 5Answers: 0

    Thanks Allan, I will get it tomorrow!

This discussion has been closed.