genemu / GenemuFormBundle

Extra Form : Captcha GD, Tinymce, Recaptcha, JQueryDate, JQueryAutocomplete, JQuerySlider, JQueryFile, JQueryImage
587 stars 263 forks source link

updated jquery rating #341

Closed ghost closed 10 years ago

ghost commented 10 years ago

class was missing in the form widget

Molkobain commented 10 years ago

Hi,

what is that fix for ?

WedgeSama commented 10 years ago

+1 to @Molkobain

ghost commented 10 years ago

I get normal radio buttons without this class. Am I doing something wrong ?

Molkobain commented 10 years ago

It's working ok for me without touching anything, maybe you have forget something in your code. Would you like to post it here so we could take a look ?

ghost commented 10 years ago

Sure, so I'm using sonata sandbox and I'm including this in the comment section of the ecommerce product page. My formtype is something like .

$builder->add(
                'note',
                'genemu_jqueryrating',
                array(
                    'required' => false,
                    'configs'  => array(
                        'readOnly' => true
                    ),
                    'choices'  => $this->noteProvider->getValues()
                )
            );

and the twig is

    {{ form_label(form.note, 'form_label_note'|trans({}, 'SonataCommentBundle'), {'horizontal_label_class': ''}) }}
    {{ form_widget(form.note) }}
...

    <script src="{{ asset('/bundles/bundleName/js/jquery-ui.min.js') }}"></script>
    <script src="{{ asset('/bundles/bundleName/js/jquery.rating.pack.js') }}"></script>

the jquery.rating.css is included in the template also

with the attr I included in the pr the widget works like a charm, without it, plain old radio buttons .

Molkobain commented 10 years ago

Try to call the genemu javascript part by adding {{form_javascript(form)}}

ghost commented 10 years ago

that was my problem thank you

Molkobain commented 10 years ago

Glad it helped :)

Regarding which part of Genemu you are using, you might also need the {{form_layout(form)}} for the HTML parts and/or the {{form_stylesheets(form)}} for the CSS parts

More informations here : https://github.com/genemu/GenemuFormBundle/blob/master/Resources/doc/template.md