2012-05-10 5 views
0

login.phtmlからログイン/登録フォームを変更していますが、標準のcssボタンの代わりに画像ボタンを使用すると「アカウントを作成」ボタンに問題があります。なぜonclick = window.locationはMagentoカスタムログインフォームの非関連フィールドのフォーム検証を開始しますか?

私は

<input type="image" src="http://localhost/magento/skin/frontend/default/mytemplate/images/button-createaccount.png" title="<?php echo $this->__('Create an Account') ?>" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"> 

に、この元のコード

   <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button> 

を変更し、 "アカウントを作成" のdiv浮動右の "コンテンツ" のdivの中にボタンを移動しました。ボタンは正しく表示されますが、アカウントの作成をクリックするたびに、ブラウザは左のフローティング "ログイン" divでログインフォームの必須フィールドを強調表示してから、アカウント作成ページに進みます。

元のCSS作成アカウントボタンをクリックすると、ページの下部(別のdiv内、ログインの一部でもなくアカウントdivも作成されません)にブラウザが正しくフォームのフィールドを強調表示せずに正しく進みます。これはどういうわけかdivの中のボタンの位置やwindow.locationメソッドと関係がありますか?

<script type="text/javascript"> 
    var dataForm = new VarienForm('login-form', true); 
</script> 

これは明らかにbehaingされているデフォルト動作の数を持っています。フォームがVarien_FormとしてJavaScriptで開始されたので、あなたは彼の問題を抱えている

<div class="account-login"> <?php echo $this->getMessagesBlock()->getGroupedHtml() ?> 
    <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form"> 
    <div class="col2-set"> 
    <div class="col-2 new-users"> 
     <div class="content"> <?php echo $this->__('New Customers') ?> 
     <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p> 
     <!-- Insert image button for Create Account in new div class "button" --> 
     <div class="button"> 
      <input type="image" src="http://localhost/magento/skin/frontend/default/mytemplate/images/button-createaccount.png" title="<?php echo $this->__('Create an Account') ?>" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"> 
     </div> 
     <!-- End Insert image button for Create Account in new div class "button" --> 
     </div> 
    </div> 
    <div class="col-1 registered-users"> 
     <div class="content"> 
     <h2><?php echo $this->__('Registered Customers') ?></h2> 
     <p><?php echo $this->__('If you have an account with us, please log in.') ?></p> 
     <ul class="form-list"> 
      <li> 
      <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('persistent.remember.me'); ?> 
     </ul> 
     <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?> 
     <!-- Insert image button for Login in div class "button" --> 
     <div class="button"> 
      <input type="image" src="http://localhost/magento/skin/frontend/default/mytemplate/images/button-login.png" title="<?php echo $this->__('Login') ?>" name="send" id="send2"> 
     </div> 
     <!-- End Insert image button for Login in div class "button" --> 
     <div class="buttons-set"> <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a> </div> 
     </div> 
    </div> 
    <div class="col2-set"> 
     <div class="col-2 new-users"> 
     <div class="buttons-set"> 
      <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button> 
     </div> 
     </div> 
     <div class="col-1 registered-users"> 
     <div class="buttons-set"> <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a> 
      <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button> 
     </div> 
     </div> 
    </div> 
    <?php if (Mage::helper('checkout')->isContextCheckout()): ?> 
    <input name="context" type="hidden" value="checkout" /> 
    <?php endif; ?> 
    </form> 
    <script type="text/javascript"> 
       var dataForm = new VarienForm('login-form', true); 
    </script> 
</div> 

答えて

1

はここで完全なコードです不思議なことに、ボタンや要素に遭遇したときには期待していません。これらはMagentoのjsライブラリのどこかで定義されています。

これは正しい方向に向けるのに役立ちます。

+0

ありがとうございました。私は今、CSSとスライドドアの技術でそれをやりました。 – Socrates

+0

問題が全くありません。 –

関連する問題