Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Zend Form Validator Callback: How to exclude a username?
  2. $username = $this->createElement('text','username');
  3. $username->setLabel('Username:')
  4.          ->addValidator('Callback', true, array('callback'=>userExist???));
  5.        
  6. $element->addValidator('Db_NoRecordExists', true, array('users', 'username'))
  7.        
  8. $where = array('users', 'username', array('field' => 'username', 'value' => $username));
  9. $element->addValidator('Db_NoRecordExists', true, $where)