Thanks for the help given. To give some more details, I have several problems am trying to sort namely;
1. I have a very long controller, which I'll be getting to separate to more controllers. This is why I gave only the last part of the code, excluding the form. I have noted that I may also need help in separating the long code to several controllers. I'll get to this later.See below. 2. I am trying several options to get the best chatbot feature, hence the q, a coming in separately. The replies tables give the previous questions and answers the user has seen, while the q,a are the new questions and answers coming in, hence appearing at the bottom of the page. See the js code, and the limitby(0,2). My aim, since this maybe different from other bot codes is to allow a user to question or search, the question gets posted in the database and the system modules search for the answer that also gets posted into the answers table. This is the table that is iterated getting 'replies'. 3. I have dome some scripting work including 'minify' etc that so far has helped reduce the loading speed. That's why I gave this part of code, thinking that maybe that's where to issue is. Below is the start of the controller code, containing several hundred lines: @mobilize @auth.requires_login() def view_searches(): if db(db.post).isempty(): db.post.insert(message="Hi, it's" +' ' +auth.user.first_name+' '+ 'loging in...') form = SQLFORM(Post, formstyle='table3cols',) if form.process().accepted: pass messagev = '' for r in db(db.post.author == auth.user.id).select(db.post.ALL): messagev = r.message form1 = messagev.split() name3 = ' '.join(form1).lower() ...more lines of code At the limitby(0,2) am using the js code below to obtain the string for the q, and a. js code: <script type="text/javascript" async=""> (function(){var e;e=function(e){var t;return this.text=e.text,this.message_side=e.message_side,this.draw=(t=this,function(){var e;return(e=$($(".message_template").clone().html())).addClass(t.message_side).find(".text").html(t.text),$(".messages").append(e),setTimeout(function(){return e.addClass("appeared")},0)}),this},$(function(){var t,s,n;s="right",t=function(){return $(".message_input").val()},n=function(t){var n;if(""!==t.trim())return $(".message_input").val(""),n=$(".messages"),new e({text:t,message_side:s="left"===s?"right":"left"}).draw(),n.animate({scrollTop:n.prop("scrollHeight")},3)},$(".send_message").click(function(e){return n(t())}),$(".message_input").keyup(function(e){if(13===e.which)return n(t())}),n("{{=q}}"),setTimeout(function(){return n("{{=a}}")},1500)})}).call(this); </script> On Mon, Jun 11, 2018 at 6:10 PM Anthony <abasta...@gmail.com> wrote: > {{=form.custom.begin}} >> > > Where does form come from? It does not appear to be defined in the > controller. If there is more code, you should show it. > > Anthony > > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/O6CxDRViyNA/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/d/optout. > -- 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.