2
このエラーが発生し、このエラーが原因で電子メールを送信できませんでした。私はopencart v2.0.1.1で新しい拡張子Birthday reminderを追加しました 私はエラーについて検索しましたが、解決できませんでした。助けてください。ファイルのコードはこれです。TypeError:インタフェースHTMLTextAreaElementを実装していないオブジェクトで 'checkValidity'が呼び出されました
<form class="form mailForm">
<div class="row form-group" style="text-align: center; font-size: 18px;">
<div class="col-xs-4">
<div class="brCustomerMailInfo">
<label>To: </label>
<strong><?php if(!empty($customerInfo['email'])) echo $customerInfo['email']; ?></strong>
<input type="hidden" name="customer_id" value="<?php if(!empty($customerInfo['customer_id'])) echo $customerInfo['customer_id']; ?>" />
<input type="hidden" name="to_mail" value="<?php if(!empty($customerInfo['email'])) echo $customerInfo['email'];?>" />
</div>
</div>
<div class="col-xs-4">
<div class="brCustomerMailInfo">
<label>Born:</label>
<strong><?php if(!empty($customerInfo['birthday_date'])){
echo $customerInfo['birthday_date'];
}
?></strong>
</div>
</div>
<div class="col-xs-4">
<div class="brCustomerMailInfo">
<label>Age:</label>
<strong>
<?php if(!empty($customerInfo['birthday_date'])) {;
$now = new DateTime("now");
if (strpos($customerInfo['birthday_date'],'/') !== false) {
echo floor((time()-strtotime(str_replace('/', '-', $customerInfo['birthday_date'])))/(365*60*60*24)) ;
} else {
echo floor((time()-strtotime($customerInfo['birthday_date']))/(365*60*60*24)) ;
}
}?>
</strong>
</div>
</div>
</div>
<div class="row form-group">
<div class="col-xs-3">
<h5><strong><?php echo $discount_code_text ?></strong></h5>
</div>
<div class="col-xs-9">
<strong><?php echo $discount_code?></strong>
<input type="hidden" class="brSmallField form-control" name="discount_code" value="<?php echo $discount_code?>">
</div>
</div>
<div class="row form-group">
<div class="col-xs-3"><h5><strong><span class="required">* </span><?php echo $type_of_discount;?></strong></h5></div>
<div class="col-xs-3">
<select class="form-control" name="discount_type" >
<option value="P"><?php echo $percentage_text?></option>
<option value="F" <?php if(!empty($data['BirthdayReminder']['discount_type']) && $data['BirthdayReminder']['discount_type'] == "F") echo "selected";?>><?php echo $fixed_amount; ?></option>
</select>
</div>
</div>
<div class="row form-group">
<div class="col-xs-3"><h5><strong><span class="required">* </span><?php echo $discount_text;?></strong></h5></div>
<div class="col-xs-3">
<div class="input-group">
<input type="text" class="brSmallField form-control" name="discount" value="<?php if(!empty($data['BirthdayReminder']['discount'])) echo $data['BirthdayReminder']['discount']; ?>">
<span class="input-group-addon" >%</span>
</div>
</div>
</div>
<div class="row form-group">
<div class="col-xs-3"><h5><strong><span class="required">* </span><?php echo $total_amount; ?></strong></h5></div>
<div class="col-xs-3">
<div class="input-group">
<input type="text" class="brSmallField form-control" name="total_amount" value="<?php echo $data['BirthdayReminder']['total_amount'] ?>">
<span class="input-group-addon" ><?php echo $currency ?></span>
</div>
</div>
</div>
<div class="row form-group">
<div class="col-xs-3"><h5><strong><span class="required">* </span>Subject:</strong></h5></div>
<div class="col-xs-3">
<input placeholder="Mail subject" type="text" id="subject" class="form-control" name="subject" value="<?php if(!empty($data['BirthdayReminder']['subject'])) echo $data['BirthdayReminder']['subject']; else echo $default_subject; ?>" />
</div>
</div>
<div class="row form-group">
<div class="col-xs-3"><h5><strong><span class="required">* </span><?php echo $user_email; ?></strong></h5></div>
<div class="col-xs-9">
<textarea class="form-control" id="giftMessage">
<?php if(!empty($customerInfo)) {
$wordTemplates = array("{firstname}", "{lastname}", "{discount_code}");
$words = array($customerInfo['firstname'], $customerInfo['lastname'], $discount_code);
if(!empty($data['BirthdayReminder']['message'][$customerInfo['language_id']])) {
$message = str_replace($wordTemplates, $words,$data['BirthdayReminder']['message'][$customerInfo['language_id']]);
echo $message;
} else {
$default_message = str_replace($wordTemplates, $words, $default_message);
echo $default_message;
}
}?>
</textarea>
</div>
</div>
<div class="row form-group">
<div class="col-xs-4"> </div>
<div class="col-xs-4" style="text-align: center"><button class="btn btn-lg btn-primary" id="sendGift"><?php echo $send_gift_button; ?></button></div>
</div>
</form>
<script>
var gettingOptions = function() {
$('textarea[id="giftMessage"]').each(function(index, element) {
$('#'+element.id).summernote({
height:150
});
$('.btn#sendGift').on('click', function(e){
e.preventDefault();
var currentYear = new Date().getFullYear();
var errorInput = false;
if(!$('input[name="subject"]').val()){
e.preventDefault();
errorInput = true;
$('input[name="subject"]').css({'background':'#f2dede'});
}
if(!validateNumber($('input[name="discount"]'), e)) {
errorInput = true;
}
if(!validateNumber($('input[name="total_amount"]'), e)) {
errorInput = true;
}
if(!errorInput) {
var isSentGift = false;
var lastGift = "<?php if(isset($customerInfo['last_gift_date'])){ $date = explode('-', $customerInfo['last_gift_date']); echo $date[0]; } else { echo '0';}?>";
if(currentYear == lastGift){
isSentGift= true;
}
sentAgain = true;
if(isSentGift) {
var last_gift_date = "<?php if(!empty($customerInfo['last_gift_date'])) {
echo $customerInfo['last_gift_date'];
}
?>";
var sentAgain=confirm("A gift is sent to this customer on " + last_gift_date + ". Do you want to sent this again?");
}
if(sentAgain){
$.ajax({
url: 'index.php?route=<?php echo $modulePath;?>/sendGift&token=' + getURLVar('token') ,
dataType: 'html',
data:{
discount_code: $("input[name='discount_code']").val(),
discount: $("input[name='discount']").val(),
total_amount: $("input[name='total_amount']").val(),
discount_type: $("select[name='discount_type']").val(),
customer_id: $("input[name='customer_id']").val(),
to_mail: $("input[name='to_mail']").val(),
subject: $("input[name='subject']").val(),
gift_message: $('#'+element.id).summernote('code') },
type: 'POST',
dataType:"json",
success: function(data){
$('.messageHasBeenSent').show().delay(3000).fadeOut(600);
$('.btn.btn-link.active').click();
}
});
}
$("#sendEmailModal").modal('hide');
}
else {
e.preventDefault();
}
});
});
};
$("#sendEmailModal").on('shown.bs.modal', function (e) {
gettingOptions();
});
if($('select[name="discount_type"]').val() == 'P'){
$('#percentageAddonForm').show();
} else {
$('#currencyAddonForm').show();
}
$('select[name="discount_type"]').on('change', function(e){
if($(this).val() == 'P') {
$('#percentageAddonForm').show();
$('#currencyAddonForm').hide();
} else {
$('#currencyAddonForm').show();
$('#percentageAddonForm').hide();
}
});
function validateNumber(input, theEvent) {
var regex = /[0-9]|\./;
if(!regex.test(input.val())) {
input.css({'background':'#f2dede'});
return false;
} else {
return true;
}
}
</script>