Pertanyaan Textfield bersembunyi setelah kami mengklik tombol batal


kami menggunakan situs magento multi-vendor

kami menggunakan kode berikut untuk memperbarui dan membatalkan harga. tetapi setelah kita klik pada "membatalkan" tombol textfield bersembunyi.

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();
}

6
2017-12-17 12:02


asal


Jawaban:


hapus baris ini $wk_jq(qtyId).hide(); karena pada batal Anda bersembunyi input field dalam fungsi.

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>

3
2017-12-17 12:06



*There is a minor mistake you are doing with the Cancel button.*

Kamu adalah memanggil hideResetPrice () berfungsi pada klik tombol batal. Hanya hapus onclick = "hideResetPrice () fungsi. Dan biarkan kode itu   hanya. Ini tidak akan menyembunyikan bidang teks Anda.

<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>

1
2017-12-29 06:31