some please help me , i am using web2py for simple addition of 2 numbers application , i have created a function called "calc" in default.py and wrote the following code in it
*def calc():* * answer=request.vars.a+request.vars.b* * return dict(answer)* * * i created a file called default/add.html & wrote following code in it: * * <html> <form action="calc" method="POST"> <input name="a" required/><br> <input name="b" required/><br> <input type="submit"/> </form> </html> again i created another file called default/calc.html & wrote the following code: <html> <h1>{{=answer}}</h1> </html> now when i enter 2 numbers in text field & click submit , i am getting lots of errors & unable to get the answer , is there anything wrong in code , please help me .... On Fri, Sep 6, 2013 at 9:02 AM, dhmorgan <dharrimanmor...@gmail.com> wrote: > for any function, you can specify the template to be used to render the > data you return; a couple of helpful bits from the book can be found at: > > http://www.web2py.com/books/default/search/29?search=response.view%2C+vars%29<http://www.web2py.com/books/default/search/29?search=response.render%28view%2C+vars%29> > > essentially, in your function, you can set the template using > "response.view = 'controller_name/template_name.ext'"; alternately, you can > combine the template and data in one with "return > response.render('template_path',dictionary_name)" > > On Friday, September 6, 2013 10:16:46 AM UTC-5, kranthi aeronaut wrote: >> >> hii all , i am new to web2py , it seems that in web2py for every function >> we declare in default.py page , we should also create a new html page with >> same name of function , is this mandatory or is there any other way to >> implement the logic ?? >> > -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/bCojfljja54/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > -- "When FREEDOM matters,EVERY THING is returned to you" -kr@nthi kum@r -- --- 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/groups/opt_out.