Display problems with verifying a form with "Remote"
hello,
when i write in the email input text :
- an email saved in the data base, the red outline of the other text input disappear abnormally.
- an email properly structured email (no saved in the data base), the message "Adresse email déjà utilisée" appears for a few seconds, then it should not.
thank you in advance for your help and here is my code :
translation.tmx...
- <tu tuid="errorLBoxEmail">
- <tuv xml:lang="fr_fr"><seg>Email incorrect</seg></tuv>
- <tuv xml:lang="en"><seg></seg></tuv>
- </tu>
- <tu tuid="errorLBoxEmail2">
- <tuv xml:lang="fr_fr"><seg>Adresse email déjà utilisée</seg></tuv>
- <tuv xml:lang="en"><seg></seg></tuv>
- </tu>
- ...
new.phtml
- ...
- <div class="registrationLBoxColLine inputLBox">
- <label id="emailLBoxLabel" class="required text lBoxLabel"><?php echo $translation->_('email') ?> (*)</label>
- <input type="text" name="email" class="required email lBoxInput" id="emailLBoxInput" />
- <!-- Error -->
- <label class="error" id="emailLBoxError" for="emailLBoxInput">
- <span class="errorLeft"></span>
- <span class="errorCenter" id="errorCenterEmailSpan"><?php echo $translation->_('errorLBoxEmail') ?></span>
- <span class="errorCenter2" id="errorCenter2EmailSpan"><?php echo $translation->_('errorLBoxEmail2') ?></span>
- <span class="errorRight"></span>
- </label>
- </div>
- ...
ooptic.js
...
- $("#formValidator").validate( {
- rules : {
- email : {
- required: true,
- email: true,
- remote : "/User/index/check-email"
- }
- },
- messages : {
- email : {
- required : function() {
- $('#errorCenter2EmailSpan').hide();
- $('#errorCenterEmailSpan').show();
- },
- email : function() {
- $('#errorCenter2EmailSpan').hide();
- $('#errorCenterEmailSpan').show();
- },
- remote : function() {
- $('#errorCenterEmailSpan').hide();
- $('#errorCenter2EmailSpan').show();
- }
- }
- },
- ignoreTitle : true,
- errorPlacement : function( error, element) {
- error.remove();
- },
- submitHandler : function(form) {
- $(form).ajaxSubmit( {
- beforeSubmit : function() {
- $(document).scrollTop(0); // Top position of lightbox
- // (loader)
- $('#progressBarDisplay').show();
- $('#newUserContent').hide();
- },
- success : function(datas) {
- if (datas == 0) {
- $('#progressBarDisplay').hide();
- $('#newUserContent').show();
- } else {
- $("#datas").html(datas);
- /*
- * Ce n'est pas la bonne méthode à voir ensemble car ça
- * duplique le JS
- */
- // $('.global').load("/");
- }
- Ooptic.User.formValidator();
- }
- });
- }
- });
...