一旦我们点击取消按钮,Textfield就会隐藏起来 [英] Textfield is hiding once we click on cancel button

查看:95
本文介绍了一旦我们点击取消按钮,Textfield就会隐藏起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用magento multi vendor site

我们使用以下代码更新和取消价格。但是一旦我们点击取消按钮,文本框就隐藏起来了。

PHTML
$ b

 < span class =label pro_status> 
<?php // echo $ products-> getPrice(); ?>
< input class =ama1type =textid =price_<?php echo $ products-> getId();?> onkeydown =validateNumbers(event)name =pricevalue =<?php echo $ products-> getPrice(); >style =/>


< p id =updatedprice_<?php echo $ products-> getId(); ?>style =display:none; color:red;位置:相对; top:16px;>已更新< / p>
< br />

< button id =price_update_button_<?php echo $ products-> getId(); ?>class =updateonclick =updateFieldPrice('<?php echo $ products-> getId();?>');返回false;>
< span>< span style =font-size:12px;><?php echo $ helper-> __('Update')?>< / span>< / span>
< / button>


< button id =price_reset_button_<?php echo $ products-> getId(); ?>type =resetclass =cancelonclick =hideResetPrice('<?php echo $ products-> getId();?>');返回false;>
< span>< span><?php echo $ helper-> __('Cancel')?>< / span>< / span>
< / button>

< / span>

Javascript

  function hideResetPrice(product_id){

var qtyId ='#price_ '+ product_id;
var editLink =#price_edit_link _+ product_id;
var updateButton =#price_update_button _+ product_id;
var valueprice =#valueprice _+ product_id;
var resetButton =#price_reset_button _+ product_id;

$ wk_jq(qtyId).hide();
$ wk_jq(valueprice).show();
$ wk_jq(editLink ).show();
$ wk_jq(updateButton).hide();
$ wk_jq(resetButton).hide();
}


解决方案

删除此行 $ wk_jq(qtyId).hide(); 因为取消你隐藏输入字段在函数中。

  function hideResetPrice(product_id,pric eold){

var qtyId ='#price _'+ product_id;
var edit =#price_edit_link _+ product_id;
var updateButton =#price_update_button _+ product_id;
var valueprice =#valueprice _+ product_id;
var resetButton =#price_reset_button _+ product_id;


$ wk_jq(valueprice).show();
$ wk_jq(qtyId).val(priceold);
$ wk_jq(editLink).show();

$ b

 <?php // echo $ products-> getPrice(); ?> 
< input class =ama1type =textid =price_<?php echo $ products-> getId();?> onkeydown =validateNumbers(event)name =pricevalue =<?php echo $ products-> getPrice(); >style =/>




< p id =updatedprice_<?php echo $ products-> getId() ; ?>style =display:none; color:red;位置:相对; top:16px;>已更新< / p>
< br />

< button id =price_update_button_<?php echo $ products-> getId(); ?>class =updateonclick =updateFieldPrice('<?php echo $ products-> getId();?>');返回false;>
< span>< span style =font-size:12px;><?php echo $ helper-> __('Update')?>< / span>< / span>
< / button>


< button id =price_reset_button_<?php echo $ products-> getId(); ?>type =resetclass =cancelonclick =hideResetPrice('<?php echo $ products-> getId();?>','<?php echo $ products-> getPrice();?>');返回false;>
< span>< span><?php echo $ helper-> __('Cancel')?>< / span>< / span>
< / button>

< / span>


we are using magento multi vendor site

we are using following code to update and cancel price . but once we click on "cancel" button textfield is hiding.

PHTML

<span class="label pro_status">
 <?php //echo $products->getPrice(); ?>                              
 <input class="ama1" type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getPrice(); ?>" style = ""/>


 <p id="updatedprice_<?php echo $products->getId(); ?>" style = "display:none;color:red; position:relative; top:16px;">Updated</p>
 <br/>

 <button id="price_update_button_<?php echo $products->getId(); ?>" class="update" onclick="updateFieldPrice('<?php echo $products->getId(); ?>'); return false;" >
 <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
 </button>


     <button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>'); return false;">
     <span><span><?php echo $helper->__('Cancel') ?></span></span>
     </button>

    </span>

Javascript

function hideResetPrice(product_id) {

var qtyId='#price_'+ product_id;
var editLink="#price_edit_link_"+ product_id;
var updateButton="#price_update_button_"+ product_id;
var valueprice="#valueprice_"+ product_id;
var resetButton="#price_reset_button_"+ product_id;

$wk_jq(qtyId).hide();
$wk_jq(valueprice).show();
$wk_jq(editLink).show();
$wk_jq(updateButton).hide();
$wk_jq(resetButton).hide();
}

解决方案

remove this line $wk_jq(qtyId).hide(); because on cancel you are hiding input field in function.

function hideResetPrice(product_id,priceold) {

    var qtyId='#price_'+ product_id;
    var editLink="#price_edit_link_"+ product_id;
    var updateButton="#price_update_button_"+ product_id;
    var valueprice="#valueprice_"+ product_id;
    var resetButton="#price_reset_button_"+ product_id;


    $wk_jq(valueprice).show();
     $wk_jq(qtyId).val(priceold);
    $wk_jq(editLink).show();

    }

<?php //echo $products->getPrice(); ?>                              
 <input class="ama1" type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getPrice(); ?>" style = ""/>




<p id="updatedprice_<?php echo $products->getId(); ?>" style = "display:none;color:red; position:relative; top:16px;">Updated</p>
 <br/>

 <button id="price_update_button_<?php echo $products->getId(); ?>" class="update" onclick="updateFieldPrice('<?php echo $products->getId(); ?>'); return false;" >
 <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
 </button>


     <button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>','<?php echo $products->getPrice(); ?>'); return false;">
     <span><span><?php echo $helper->__('Cancel') ?></span></span>
     </button>

    </span>

这篇关于一旦我们点击取消按钮,Textfield就会隐藏起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆