Magento2 copied value using Jquery, but getting error like this is a required field
₹100-400 INR / hour
Completed
Posted over 5 years ago
₹100-400 INR / hour
I have added a custom field for example - artist price, the value of which is being copied to price field but when saving the form, I am still getting error this is a required field
The code I am using is like:
$("[name='product[artist_price]']").change(function() {
$("[name='product[price]']").val($(this).val());
});
what I understand is that since the value is being copied and not filled using the keyboard, it assumes that the field is still empty or something else I am not sure.
also after testing I want to hide the field product[price], so how I can achieve this without getting the validation error.
he complete html code for the target field is like this:
<input class="admin__control-text" data-bind="
event: {change: userChanges},
value: value,
hasFocus: focused,
valueUpdate: valueUpdate,
attr: {
name: inputName,
placeholder: placeholder,
'aria-describedby': noticeId,
id: uid,
disabled: disabled
}" name="product[price]" aria-describedby="notice-G2FT2Q2" id="G2FT2Q2" type="text">