2013-04-04 44 views
0

在模板register.phtml中,我爲某些條款和條件協議添加了輸入類型收音機。 這是必需的。無法使用varien

我沒有成功使用JavaScript Magento的前端驗證。我添加了各種類,但沒有任何工作。

有人知道該怎麼做嗎?感謝

這裏的HTML

<div class="field radiobox"> 
    <div class="input-box"> 
     <input type="radio" name="accept" title="<?php echo $this->__('I Agree to our Terms & Conditions') ?>" id="accept" class="radio required-entry validate-one-required-by-name validation-passed validation-failed" > 
     <label for="accept" class=required" ><?php echo $this->__('I Agree to our Terms & Conditions') ?></label> 
    </div> 
</div> 
<script type="text/javascript"> 
    //<![CDATA[ 
     new Varien.FileElement('accept'); 
    //]]> 
</script> 
+0

什麼你的註冊文件看起來如何? – Mufaddal 2013-04-04 09:25:14

+0

你是否刪除了這個新的Varien.FileElement('accept');或不是? – Mufaddal 2013-04-04 12:23:11

+0

是的,我刪除了它 – Robert 2013-04-04 12:27:56

回答

0

首先,刪除所有其它同類然後在需要進入

<input type="radio" name="accept" title="<?php echo $this->__('I Agree to our Terms & Conditions') ?>" id="accept" class="radio required-entry" > 

,並把這個在你的表單標籤,你不需要建立任何JavaScript因爲這只是確保它是在form標籤下,在register.phtml文件中,magento已經定義了驗證的JavaScript,所以不要再次把你的javascript。

+0

感謝Mufaddal爲你的答案,但不幸這不走。 – Robert 2013-04-04 09:05:12

+0

mmmmh ...我會看看它,直到一天結束...並告訴你... – Robert 2013-04-04 13:06:52

+0

好吧我已經刪除了腳本,其中varien驗證的instancied。 – Robert 2013-04-05 09:46:27

0

@Mufaddal

<div class="account-form-wrapper registerpass"> 
      <form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="form-validate" enctype="multipart/form-data" class="ctools-use-modal-processed" novalidate="novalidate"> 
       <div class="fieldset"> 
        <input type="hidden" name="success_url" value="<?php echo $this->getSuccessUrl() ?>" /> 
        <input type="hidden" name="error_url" value="<?php echo $this->getErrorUrl() ?>" /> 
       </div> 
<?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?> 

       <div class="field"> 
        <label for="email_address" class="required"><em>*</em>Email Address</label> 
        <div class="input-box"> 
         <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" placeholder="<?php echo $this->__("Email Address") ?>" /> 
        </div> 
       </div> 

       <div class="fields"> 
        <div class="field"> 
         <label for="password" class="required"><em>*</em><?php echo $this->__('Password') ?></label> 
         <div class="input-box"> 
          <input type="password" name="password" id="password" title="<?php echo $this->__('Password') ?>" class="input-text required-entry validate-password" placeholder="Password" /> 
         </div> 
        </div> 
        <div class="field"> 
         <label for="confirmation" class="required"><em>*</em><?php echo $this->__('Confirm Password') ?></label> 
         <div class="input-box"> 
          <input type="password" name="confirmation" title="<?php echo $this->__('Confirm Password') ?>" id="confirmation" class="input-text required-entry validate-cpassword" placeholder="Confirm Password" /> 
         </div> 
        </div> 
       </div> 

       <div class="field radiobox"> 
        <div class="input-box"> 
         <input type="radio" name="accept" title="<?php echo $this->__('I Agree to our Terms & Conditions') ?>" id="accept" class="radio required-entry" > 
         <label for="accept" class=required" ><?php echo $this->__('I Agree to our Terms & Conditions') ?></label> 
        </div> 
       </div> 
__( '提交')?>」 ID = 「形式提交」> __( 'maak mijn profiel AAN')?>
   </form> 
+0

好的...我會看到它,直到一天結束...並告訴你... – Robert 2013-04-04 13:07:34