blackknight467 / StarRatingBundle

star rating bundle for symfony
MIT License
26 stars 40 forks source link

Usage in forms #2

Closed Thonior closed 9 years ago

Thonior commented 9 years ago

Hi!

I am trying to use your bundle and I found that I cannot make it work in the form.

I added in my form builder this line

->add('rating', 'rating', array('label' => 'Rating'));

and now I can see this field:

image

But it is not working as expected when clicking at some star. When I do mouseout the whole stars get deactivated again and the input field

still shows 0 as value.

May I be doing something wrong?

Another topic is if you made or thought on some way to make this work in ajax, anyway once I can make work the normal functionality I can implement on myself the ajax sendinf of the rating.

Thanks and best regars!

blackknight467 commented 9 years ago

Sounds like you forgot to add the javascript. please double check that you have it included it on your page. (you should have both jquery and rating.js on the page)

Thonior commented 9 years ago

image It's added

blackknight467 commented 9 years ago

ok, can you look on the rendered webpage in your browser and see if there are any page assets that 404 or any javascript execution errors output to your browser's console.

if everything has loaded correctly and you see no javascript errors after page load, then it's possible that there is a naming collision with something else on the page.

in your browser's developer tools, find the js block below:

var labelWasClicked = function labelWasClicked(){
    var input = $(this).siblings().filter('input');
    input.val($(this).attr('data-value'));
}

and put a breakpoint on the var input = $(this).siblings().filter('input');

if the breakpoint isn't triggered then that means the listener isn't set up right. I would need to see your html output in order to tell you what's wrong at that point.

if the breakpoint is triggered and it's still not working properly, my best guess it that you have some other js working on the same block

Thonior commented 9 years ago

I let you know on sunday, I am not in the computer anymore today and saturday. Thanks for your really fast response.

Thonior commented 9 years ago

I just put my hands on the project again today and it is working fine :s Probably was something cached. Sorry for the inconveniences

blackknight467 commented 8 years ago

@sobha-radhakrishnan what version of font awesome and symfony are you using?

blackknight467 commented 8 years ago

@sobha-radhakrishnan specific symfony 2 version please.