2

once we click on button in product view page we are displying pop up form to login or Register, here "email" & "password" validation is not working. if we enter wrong email id and password , still allowing to click Login button.

enter image description here

but its doing other validation like " email id format , 6 entries in password field"

enter image description here

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
    <div id="ajaxlogin-login-window" style="display: none;">
        <div class="page-title">
            <span><?php echo $this->__('Login into your Account 4') ?></span>
        </div>
       <form action="some code" id="ajaxlogin-login-form">
            <div class="content">
                <ul class="form-list">
                    <li>
                    <input type="hidden" id="likeproduct_id" name="product_id" value=""/>
                        <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                        </div>
                    </li>
                    <li>
                        <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                        </div>
                    </li>
                    <?php echo $this->getChildHtml('form.additional.info'); ?>
                </ul>
            </div>
            <div class="buttons-set">

                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>            

            </div>
        </form>
        <script type="text/javascript">
            //<![CDATA[
            var ajaxLoginForm = new VarienForm('ajaxlogin-login-form', true);
jQuery("#ajaxlogin-login-form").submit(function(e) {
    e.preventDefault();
    if (ajaxLoginForm.validator.validate()) {
        jQuery.ajax({
            type: "POST",
            url: jQuery('#ajaxlogin-login-form').attr('action'),
        }).done(function(result) {
            alert(result);
        }).fail(function() {
            alert('There is some error saving your design.');
        });
    }
});
            //]]>
        </script>
    </div>
<?php endif; ?>

<script type="text/javascript">
function setproductlogin(pid)
{
    document.getElementById("likeproduct_id").value=pid;
   jQuery("#productlistlogin").trigger("click");
}

</script>
1

What exactly problem do you have?
Validation for property credentials is on backend side after click Login button (controller).
If credentials are wrong it should be information displayed. Is it ok? Or it is break on Login all the time?

Validate for email input is defined in login input:

<input type="text" name="login[username]" value="<?php echo $this->htmlEscape($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />

There in class you can set validations. This one: validate-email response for validate email format.

For password :

<input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />

There is class also with validation validate-password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.