Hi. I am trying to use Krajee’s star-rating widget to populate a field in my database. However, when I begin to use the ‘rating’ class in the code below, my sentimental_value field disappears from my POST altogether. If I am to delete the ‘class’ => ‘rating’ line, I can enter in a number in the text field, and it works fine. I just can’t get the needed information when using the widget.
You can then receive the value of sentimental_value available in your model attributes, if you use $model->load(Yii::$app->request->post) method in your controller action. Note your attributes must be set to safe in your model validation for it to get value assigned during mass assignment.
Thanks for the help, Kartik. Your widgets seem excellent, and I look forward to using them.
I was able to get your StarRating widget to work by using your exact code, and I use the controller in the way that you described. However, in my POST, all of the values from the form are being passed to the object except for the sentimental_value. That field still isn’t being noticed as a POST field. Would you have any idea why?