Jump to content

JavaScript not working in tpl file when smarty cache enabled


waiking

Recommended Posts

Hi all,

 

i facing a problem with javascript not working in tpl file if smarty cache was enabled (Yes),  will only work when smarty cache was disabled (No).

affected code (tpl file)

                         <td>
                            <!--
                            <div class="lofrating-fields-{$lofattribute.title}" id="lofrating-fields-{$lofattribute.title}">
                                <input name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" type="radio" class="star" value="1"/>
                                <input name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" type="radio" class="star" value="2"/>
                                <input name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" type="radio" class="star" value="3"/>
                                <input name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" type="radio" class="star" value="4"/>
                                <input name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" type="radio" class="star" value="5"/>
                            </div>
                            -->
                            <div class="lofrating-fields-{$lofattribute.title} rateit" id="lofrating-fields-{$lofattribute.id_lofreview_attribute}" data-rateit-step="1"></div>
                            <input type="hidden" name="lofselect_stars[{$lofattribute.id_lofreview_attribute}]" value="" id="input_{$lofattribute.id_lofreview_attribute}"/>
                            <script type="text/javascript" language="javascript">
                            {literal}
                                var tooltipvalues = ['bad', 'poor', 'ok', 'good', 'super'];
                                $("#lofrating-fields-{/literal}{$lofattribute.id_lofreview_attribute}{literal}").bind('over', function (event, value) {
                                    $(this).attr('title', tooltipvalues[value - 1]); 
                                }).bind('rated', function() { 
                                    $('#input_{/literal}{$lofattribute.id_lofreview_attribute}{literal}').val($(this).rateit('value'));
                                }).bind('reset', function () { $('#input_{/literal}{$lofattribute.id_lofreview_attribute}{literal}').val(''); });
                            {/literal}
                            </script>

                        </td>

 

attached with screenshoot.

when cache enabled, the javascript that generate the star got missing.

Thanks for viewing and appreciate for give advice.

regards

cache_disabled.jpg

cache_enabled.jpg

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...