我正在尝试获取PHP-Laravel产品的星级评价值。但是值不包含在print_r值中。当我提交星级评定时,值评定在URL中给出了两次值,一个是实值,另一个是0,但是在print_r中,值仅给出0。以任何方式获取name属性的值。
我正在使用this library进行星级评定。表单代码:
let counter = 1;
const mergeProps = (
stateProps,
dispatchProps,
ownProps,
) => {
const copy = JSON.parse(
JSON.stringify(stateProps.selectedItems|| []),
);
const copyCounter = counter;
counter++;
console.log('creating closure for counter:', copyCounter);
return {
...stateProps,
...ownProps,
onDelete: ({ id: entityId, entityType }) =>
console.log(
'in the closure, counter is:',
copyCounter,
) ||
onDeleteDataFilter(
entityId,
entityType,
ownProps.onChange,
copy,
),
};
};
控制器代码:
key={new Date().getTime()}
答案 0 :(得分:1)
尝试
<input type="text" class="rating-kv" id ="rating" min=0 max=5 step=0.2 data-size="sm">
<input type ="hidden" name ="rating" id ="ratingValue" >
在jquery部分添加
<script>
jQuery(document).ready(function () {
$(".rating-kv").rating();
$('body').on("change","#rating",function(event){
event.preventDefault();
var rating = $(".rating-kv").val();
$("#ratingValue").val(rating);
});
});
</script>