Since I am getting an response I am guessing it doesn't work! lol.
On Wednesday, January 27, 2016 at 6:42:23 PM UTC-5, Ron Chatterjee wrote:
>
> *I have the model defined as :*
>
> db.define_table('song',
> Field('title'),
> Field('rating'))
>
> Note*: rating is in the field.
>
> *controller as:*
>
> def index():
> form = SQLFORM(db.song)
> return dict(form = form)
>
>
> *View as you mentioned:*
>
> {{=form}}
>
> <script>
> jQuery('input.rating,input[name*="rating"]').each(function(){
> var span = jQuery('<span style="white-space:nowrap"><span
> class="rate0">◎</span><span class="rate1">☆</span><span
> class="rate2">☆</span><span class="rate3">☆</span><span
> class="rate4">☆</span><span class="rate5">☆</span></span>');
> var self = jQuery(this).hide().after(span);
> var fill_stars = function() {
> var k = parseInt(self.val()) || 0;
> for(var i=1; i<6; i++)
> span.find('.rate'+i).html((i<=k)?'★':'☆');
> };
> for(var k=0; k<6; k++) (function(k){
> span.find('.rate'+k).mouseover(function(){
> for(var i=1; i<6; i++)
> span.find('.rate'+i).html((i<=k)?'★':'☆');
> }).click(function(){self.val(k);fill_stars();});
> })(k);
> span.mouseout(fill_stars);
> fill_stars();
> });
>
> </script>
>
>
> Results I get is attached but values are not stored in the database. Are
> you sure it work at your end like I have it? Just curious.
>
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.