Reputation: 157
i am validating my email field checking if the email in the database. and if so gives a message. this is the first page of my multiform. i need to showup a button on my 1st page only if the email available in my db to directly login to the system. how could i do this. button is only a link to another page. in my ss file;
$MemberRegistrationMultiForm
<p>This email has been used</p>
<p><a class="btn btn-warning" href="{$BaseHref}myaccount">Login</a></p>
<% end_if %>
Upvotes: 0
Views: 367
Reputation: 157
i removed above codes and did a validation in my page, i extended the requiredfield class as Email_Validator and call it in my original class. this bring the validation. i need to add login button if the email address exist in the db, how could i do that part
class Email_Validator extends RequiredFields {
public function php($data){
$bRet = parent::php($data);
if($bRet){
$customer = Customer::get()->filter('Email', $data['Email'])->first();
if($customer){
$this->validationError('Email', 'This email has been used ', 'bad');
//$bRet ="<p><a class='btn btn-warning' href=".Director::baseURL() . "myaccount/>Login to my account</a></p>";
$bRet = false;
}
}
return $bRet;
}
}
Upvotes: 1