0

I'm working on login.phtml, register.phtml and create.phtml and have some issues:

The button submit/validate doesn't work, I've nothing in the console (chrome console) and I tried different solution:

Customer Login Doesn't Work in 1.9

and I tried to use the initial version of login.phtml

But nothing works.

In this topic : magento 1.9 customer can not login I don't know wich path I have to put in Admin>System>Configuration>General>Web>Session Cookie Management

You can find the form here :http://sandbox.beer-route.com/devbr/customer/account/login/

To complete my post, here is the content of my login.phtml.

    <?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2016 X.commerce, Inc. and affiliates (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Create account form template
 *
 * @var $this Mage_Customer_Block_Form_Register
 */
?>

<link rel='stylesheet prefetch' href='http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'>
<div class="background-img-register">
    <div class="account-create">
        <?php echo $this->getChildHtml('form_fields_before')?>
        <?php echo $this->getMessagesBlock()->toHtml() ?>
        <?php /* Extensions placeholder */ ?>
        <?php echo $this->getChildHtml('customer.form.register.extra')?>
        <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate">
            <div class="fieldset" id="create1">
                   <div class="page-title">
                        <h1><?php echo $this->__('Create an Account') ?></h1>
                    </div>
                <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" />
                <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" />
                <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />
                <h2 class="legend"><?php echo $this->__('Personal Information') ?></h2>
                <ul class="form-list">
                    <p class="form-instructions" >Entrez vos informations personnelles ci-dessous, puis cliquez sur "Valider".<p class="required"><?php echo $this->__('* Required Fields') ?></p> </p>
                    <li class="fields">
                        <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?>
                    </li>
                    <li>
    <!--                    <label for="email_address" class="required"><em>*</em><?php //echo $this->__('Email Address') ?></label>-->
                             <span class="input input--hoshi">
                                 <input type="text" name="email" id="input-4 email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Email Address')) ?>" class="input__field input__field--hoshi required-entry" />
                                <label class="input__label input__label--hoshi input__label--hoshi-color-1" for="input-4">
                                    <span class="input__label-content input__label-content--hoshi">Votre Mail<em style="color:red;">*</em></span>
                                </label>
                            </span>
                    </li>

                <?php //$_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
                <?php //if ($_dob->isEnabled()): ?>
    <!--                <li><?php //echo $_dob->setDate($this->getFormData()->getDob())->toHtml() ?></li>-->
                <?php// endif ?>
                <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
                <?php if ($_taxvat->isEnabled()): ?>
                    <li><?php echo $_taxvat->setTaxvat($this->getFormData()->getTaxvat())->toHtml() ?></li>
                <?php endif ?>
                <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
                <?php if ($_gender->isEnabled()): ?>
                    <li><?php echo $_gender->setGender($this->getFormData()->getGender())->toHtml() ?></li>
                <?php endif ?>

                                <?php if ($this->isNewsletterEnabled()): ?>
    <!--
                    <li class="control">
                        <div class="input-box">
                            <input type="checkbox" name="is_subscribed" title="<?php //echo Mage::helper('core')->quoteEscape($this->__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php //if($this->getFormData()->getIsSubscribed()): ?> checked="checked"<?php// endif; ?> class="checkbox " />
                        </div>
                        <label for="is_subscribed"><?php //echo $this->__('Sign Up for Newsletter') ?></label>
                        <?php /* Extensions placeholder */ ?>
                        <?php //echo $this->getChildHtml('customer.form.register.newsletter')?>
                    </li>
    -->
                    <?php endif ?>
                </ul>
            </div>
        <?php //if($this->getShowAddressFields()): ?>
        <?php //endif; ?>
            <div class="fieldset" id="create3">
                <h2 class="legend"><?php echo $this->__('Login Information') ?></h2>
                <ul class="form-list">
                    <li class="fields">
                        <div class="field">
    <!--                        <label for="password" class="required"><em>*</em><?//php echo $this->__('Password') ?></label>-->
                            <div class="input-box">
                                <span class="input input--hoshi">
                                <input type="password" name="password" id="password" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Password')) ?>" class="input__field input__field--hoshi required-entry validate-password" />
                                     <label class="input__label input__label--hoshi input__label--hoshi-color-2" for="input-4">
                                        <span class="input__label-content input__label-content--hoshi">Votre Mot de Passe<em style="color:red;">*</em></span>
                                    </label>
                                </span>
                            </div>
                        </div>
                        <div class="field">
    <!--                        <label for="confirmation" class="required"><em>*</em><?php //echo $this->__('Confirm Password') ?></label>-->
                            <div class="input-box">
                                <span class="input input--hoshi">
                                    <input type="password" name="confirmation" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Confirm Password')) ?>" id="confirmation" class="input__field input__field--hoshi required-entry validate-cpassword" />  
                                     <label class="input__label input__label--hoshi input__label--hoshi-color-2" for="input-4">
                                        <span class="input__label-content input__label-content--hoshi">Confirmez Votre Mot de Passe<em style="color:red;">*</em></span>
                                    </label>
                                </span>
                            </div>
                        <div class="buttons-set">
                            <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>" class="back-link"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
                            <button type="submit" title="<?php echo $this->quoteEscape($this->__('Register')) ?>" class="button"><span><span><?php echo $this->__('Register') ?></span></span></button>
                        </div>
                        </div>
                    </li>
                    <?php echo $this->getChildHtml('form.additional.info'); ?>
                </ul>
            </div>

        </form>
        <script type="text/javascript">
        //<![CDATA[
            var dataForm = new VarienForm('form-validate', true);
            <?php if($this->getShowAddressFields()): ?>
            new RegionUpdater('country', 'region', 'region_id', <?php echo $this->helper('directory')->getRegionJson() ?>, undefined, 'zip');
            <?php endif; ?>
        //]]>
        </script>
    </div>
</div>
        <script src="/devbr/skin/frontend/beerroute/default/js/classie.js"></script>

        <script>
            (function() {
                // trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim
                if (!String.prototype.trim) {
                    (function() {
                        // Make sure we trim BOM and NBSP
                        var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
                        String.prototype.trim = function() {
                            return this.replace(rtrim, '');
                        };
                    })();
                }

                [].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) {
                    // in case the input is already filled..
                    if( inputEl.value.trim() !== '' ) {
                        classie.add( inputEl.parentNode, 'input--filled' );
                    }

                    // events:
                    inputEl.addEventListener( 'focus', onInputFocus );
                    inputEl.addEventListener( 'blur', onInputBlur );
                } );

                function onInputFocus( ev ) {
                    classie.add( ev.target.parentNode, 'input--filled' );
                }

                function onInputBlur( ev ) {
                    if( ev.target.value.trim() === '' ) {
                        classie.remove( ev.target.parentNode, 'input--filled' );
                    }
                }
            })();
        </script>
  • Welcome to Magento SE. Please don't take it as rude that I removed some personal "fluff" from the question, we prefer questions that come to the point without anything unrelated to the actual problem. Ideally, it will help others in the future, who have the same question but don't need to know your backstory. – Fabian Schmengler Aug 3 '16 at 11:21
  • That being said, it would be very helpful to see your template code instead of a link to the form. It's good that you explained what you tried to solve your problems, but a description of the actual problem and the responsible code is also essential. Otherwise we only can guess. – Fabian Schmengler Aug 3 '16 at 11:27
1

You have written

$('form').submit(function(event) {
event.preventDefault();
return false;
})

In your .phtml file or any other place. SO it cause to not submit the form. please remove that line and try it.

  • Thank you for your answer Chirag. Where did you see that ? I start to search, hoping to find. – Antoine Young Aug 3 '16 at 11:25
  • View page source of login page and you can see this kind of javascript code. After open source code just find "preventDefault". You will see the result. This code may be in "head.phtml" or "header.phtml" file of your theme. – Chirag Rajput Aug 3 '16 at 11:29
  • Nice ! You're right ! So now the button is partially working. The page reload and no message.. I continue to search how to fix it, if you have any idea don't hesitate. Thank you a lot to take time. – Antoine Young Aug 3 '16 at 11:33
  • Maybe you know if it's important to precise those information in the Admin panel (System > Configuration > Web > Cookie and Session Management) Mage.Cookies.path = '/'; Mage.Cookies.domain = 'sandbox.beer-route.com'; – Antoine Young Aug 3 '16 at 11:40
  • I have tried to create account in your site, but it gives error like "Erreur de vérification de date. Veuillez recommencer." So i can not login. Also wheni try to enter wrong info and try to login it gives error message. So it might be any module error. – Chirag Rajput Aug 3 '16 at 11:45

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.