every python code must be enclosed in {{}} also you need a {{pass}} at the end of if-else statement
On Fri, Sep 13, 2019 at 2:31 PM mostwanted <godirao...@gmail.com> wrote: > This conditional statement should be simple & execute without any issues, > I have created a point of Sale system, in a view it shows all the items & > their available quantities, what i want is that when a product's quantity > goes below 10 the quantity figure should turn red & a please refill message > should be displayed but i am not getting this, the if condition is ignored > altogether, only the else statement is executed! > > VIEW CODE > <style> > .refill > { > display: none; > color: red; > font-weight: bold; > padding: 2px; > } > </style> > {{for idx, p in enumerate(products, start=1):}} > > <tr id="soldItems"> > <script> > $(document).ready(function() > { > if({{=p.Quantity}} <10) > { > $('span.quantity').css({'color':'red'}); > $('.refill').show(); > } > else > { > $('span.quantity').css({'color':'green'}); > $('.refill').hide(); > } > }); > </script> > <td><span style="font-weight: bold; font-size: 15px;">{{=idx}} > </span></td> > <td><span class="quantity" style="font-weight: bold; font-size: 15px > ;">{{=p.Quantity}}</span> <span class="refill">Please Refill</span></td> > ............... > ............... > ............... > ............... > ............... > ............... > > Please assist > > Regards; > > Mostwanted > > -- > 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. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/c26be28b-585d-452d-a255-6ba9be30f67b%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/c26be28b-585d-452d-a255-6ba9be30f67b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- โทร 086-187-5643 -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CAFLP1QH34N1Rp6hhMrscE9ZXtPtKzTsuEoPnDc0CFXJ1NGQ4hQ%40mail.gmail.com.