It does not get inserted because this:

def index():
    form = SQLFORM(db.song)
    return dict(form = form)

should be

def index():
    form = SQLFORM(db.song).process()
    return dict(form = form)

;-)

the problem is not in the JS. Also the rating field should be an integer 
else you can run into issues.

On Thursday, 4 February 2016 21:54:14 UTC-6, Ron Chatterjee wrote:
>
> 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">&#x25CE;</span><span class="rate1">&#x2606;</span><span 
>> class="rate2">&#x2606;</span><span class="rate3">&#x2606;</span><span 
>> class="rate4">&#x2606;</span><span class="rate5">&#x2606;</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)?'&#x2605;':'&#x2606;'); 
>> }; 
>> 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)?'&#x2605;':'&#x2606;'); 
>> }).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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to