Hi all
I have a registration form which is loaded inside a div and included in the
page. I want to have some server-side validation on it and return the result
inside the specific div !!!! any idea please? its really urgent!!!!!
[Code]
<?php echo $session->flash(); ?>
<?php echo $form->create('User', array('action' => 'register','type' =>
'post','class'=>'account'));?>
<div class="anket">Adı:
<p><?php echo $form->text('first_name' , array ('length'=>20));?></p>
</div>
<div class="anket">Soy Adı:
<p><?php echo $form->text('last_name', array ('length'=>20));?></p>
</div>
<div class="anket">Username:
<p><?php echo $form->text('username', array('after' =>
$form->error('username_unique', 'The username is taken. Please try
again.')));?></p>
</div>
<div class="anket">Şifre
<p><?php echo $form->password('password');?></p>
Hatalı şifre girişi
</div>
<div class="anket">Tekrar Şifre
<p><?php echo $form->password('confirm_password');
?></p>
Hatalı şifre girişi
</div>
<div class="anket">E-posta adresi:
<p><?php echo $form->text('email', array('after' =>
$form->error('email_duplicate', 'This email address had been registered
before. Please try again.')));?></p>
E-posta adresi kullanımda
</div>
<div class="sozlesme">
<input type="checkbox" value="sozlesme" />
javascript:dropSozlesme() Kullanım Şartları 'nı kabul ediyorum.
<div class="madde">
<h3>MARKAPON KULLANICI SÖZLEŞMESİ</h3>
<p>Kullanım Şartları'nı kabul ediyorum. Kullanım Şartları'nı kabul
ediyorum. Kullanım Şartları'nı kabul ediyorum. Kullanım Şartları'nı kabul
ediyorum. Kullanım Şartları'nı kabul ediyorum. Kullanım Şartları'nı kabul
ediyorum. Kullanım Şartları'nı kabul </p>
</div>
<p style=" text-align:right; padding:5px 0px 0px 0px;"> # Yazdır </p>
</div>
<?php echo $form->submit('hesap-olustur-button.gif',
array('class'=>'submit'));?>
<?php echo $form->end(); ?>
[/Code]
[Code]
if (!empty($this->data))
{
$san = new Sanitize();
$this->data['User']['username'] =
$san->paranoid($this->data['User']['username']);
if ($this->data['User']['password']!=
$this->data['User']['confirm_password'])
{
$this->data['User']['password'] = '';
$this->data['User']['password_confirm'] = '';
$this->Session->setFlash(__('Password and
Password
confirmation should be the same.', true));
$this->redirect($this->referer(), null, true);
exit();
}
else
{
$this->User->set($this->data);
$this->User->create();
$this->User->data = Sanitize::clean($this->data);
$this->data['User']['password'] =
md5($this->data['User']['password']);
$this->User->set('join_date', date('Y-m-d H:i:s'));
$this->User->set('first_name',
$this->data['User']['first_name']);
$this->User->set('username',
$this->data['User']['username']);
$this->User->set('password',
$this->data['User']['password']);
$this->User->set('email', $this->data['User']['email']);
$this->User->set('status', 1);
$this->User->set('referred', $this->Session->read('ref'));
// Successfully created account - send activation email
//debug($this->data);
$result = $this->User->save($this->data);
//if(!$this->User->save()){
// debug($this->User->validationErrors); die();
//}
// debug($result);
if ($result)
{
// this view is not show / listed - use your
imagination and inform
// users that an activation email has been
sent out to them.
//$this->User->username =
$this->data['User']['username'];
//$this->__sendActivationEmail($this->User->getLastInsertID());
if ($this->Session->read('ref'))
{
$invited_id =
$this->getUserId($this->data['User']['username']);
$this->requestAction('/bonuses/updateStatus/'.$this->Session->read('ref').'/'.
$this->data['User']['email'].'/'. $invited_id);
}
$this->Session->setFlash('An invitation
email just been
sent.',false);
$this->redirect('/users/login');
}
// Failed, clear password field
else {
$this->data['User']['password'] = '';
$this->data['User']['password_confirm'] = '';
$this->Session->setFlash(__('Some problem
happened during
saving your information.', true));
}
}
}
}
[/Code]
--
View this message in context:
http://old.nabble.com/Dealing-with-forms%21%21%21%21%21-tp28541795p28541795.html
Sent from the CakePHP mailing list archive at Nabble.com.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en