1

I am using whiteOrderComment module for customer comment on order review page. but in this section text-area field required option not working.

I did little bit change on /checkout->onepage->review->button.phtml like this

<script type="text/javascript">
function validate(){
if(document.getElementById("whiteOrderComment").value == ""){
alert('Required');
}else{
review.save();
}


</script>

<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="button btn-checkout" onclick="validate();"><span><span><?php echo $this->__('Place Order') ?></span></span></button>

but in this page javascript not working.

can you please give any better idea, how can i make this text-area field required.

thanks

4

1 回答 1

0

你可以试试下面的。您需要将此代码放在页面上使用的任何 .js 文件中。您可以从按钮 onClick 事件中调用此函数。谢谢

function check_empty(form_id, field_name)
{
 var form = $(form_id);
 var field = form[field_name];
 var val = $(field).getValue();
 if(val == '')
 {
  $(field).addClassName('validation-failed');
  return false;
 }
 return review.save();
}
于 2012-04-10T11:31:53.743 回答