R
ragtek
Guest
How is the js AUto Validator working?
That's my implemention:
FireBug tells me, that i'm getting this error(with an false mailadress):
If the mailadress is valid, i'm getting:
BUT i can't see any message in the frontend
That's my implemention:
PHP:
public function actionValidateField()
{
$this->_assertPostOnly();
$field = $this->_getFieldValidationInputParams();
$data = array(
'name' => 'invited_mail',
'value' => $field['value']
);
return $this->_validateField('Ragtek_Invite_DataWriter_Invite',
$data
);
}
Code:
<form action="{xen:link 'invites/invite'}" method="post" class="xenForm AutoValidator"
data-fieldValidatorUrl="{xen:link invites/validate-field}"
data-normalSubmit="1">
<xen:if is="{$errors}">
<div class="errorPanel">
<h3 class="errorHeading">{xen:phrase please_correct_following_errors}:</h3>
<div class="baseHtml errors">
<ol>
<xen:foreach loop="$errors" value="$error">
<li>{xen:raw $error}</li>
</xen:foreach>
</ol>
</div>
</div>
</xen:if>
<dl class="ctrlUnit">
<dt><label for="ctrl_name">Name:</label></dt>
<dd>
<input type="text" name="username" class="textCtrl OptOut" id="ctrl_name" autofocus="true" />
<p class="explain">Name for the e-mail</p>
</dd>
</dl>
<dl class="ctrlUnit">
<dt><label for="ctrl_mail">{xen:phrase mail}:</label></dt>
<dd>
<input type="text" name="mail" class="textCtrl" id="ctrl_mail" autofocus="true" autocomplete="off" />
<p class="explain">Name for the e-mail</p>
</dd>
</dl>
Code:
{"error":{"email":"Please enter a valid email."},"templateHtml":"\n\n\n<div class=\"errorOverlay\">\n\t<a class=\"close OverlayCloser\"><\/a>\n\t\n\t\t<h2 class=\"heading\">The following error occurred:<\/h2>\n\t\t\n\t\t<div class=\"baseHtml\">\n\t\t\n\t\t\t<label for=\"ctrl_email\" class=\"OverlayCloser\">Please enter a valid email.<\/label>\n\t\t\n\t\t<\/div>\n\t\n<\/div>"}
If the mailadress is valid, i'm getting:
Code:
{"_redirectStatus":"ok","_redirectTarget":"\/xf\/upload\/","_redirectMessage":"The value 'mike@ragtek.org' was successfully validated against field 'invited_mail'."}