On Monday, July 9, 2018 at 1:05:38 AM UTC-7, Maurice Waka wrote: > > All I needed is to pass a current value to the db/controller from the > html. After much working, I found that using this was one the best options: > <script> > jQuery('#myform').submit(function() { > ajax('{{=URL('view_searche')}}', > ['message'], 'chat'); > return false; > }); > </script> >
The issue is that you are trying to do this without reloading the page? I think we previously discussed the LOAD() helper and the ajax() function <URL:http://web2py.com/books/default/chapter/29/11/jquery-and-ajax#The-ajax-function> I don't remember why those didn't work for you., but I think that would have been the simplest route. /dps > On Sun, Jul 8, 2018 at 1:26 AM Anthony <abas...@gmail.com <javascript:>> > wrote: > >> First, read the documentation at >> http://web2py.com/books/default/chapter/29/07/forms-and-validators, as >> you do not appear to be following it. If for some reason you do not want to >> use the built-in form functionality, just create an HTML form, and in the >> action that receives the submission, the submitted form values will be >> available in request.vars -- from there, you can do whatever you want with >> the data. >> >> Anthony >> >> On Saturday, July 7, 2018 at 6:02:55 PM UTC-4, Maurice Waka wrote: >>> >>> Hi. >>> I'll need your help. Am still stuck at this. I note that only when I >>> refresh the page, will I get the latest 'request.vars.value' gets posted to >>> the controller. >>> >>> 1. Is there a way of auto-refreshing the controller? >>> 2. Is there a better method that this......Following your suggested >>> option of {{form.custom.end}} i ended up with a blank page instead, >>> hence >>> going to the basics. >>> 3. My aim is that when a user posts input, I retrieve it from what >>> ever means....request.vars etc, then send to the functions to process.. >>> >>> Kind regards >>> >>> On Sat, Jul 7, 2018 at 1:33 PM Maurice Waka <mauri...@gmail.com >>> <javascript:>> wrote: >>> >>>> I managed to go to the basics and got some progress: >>>> def searches(): >>>> form = FORM(INPUT(_name='message'), INPUT(_type='submit')) >>>> code = request.vars.message >>>> return dict(code=code) >>>> >>>> view: >>>> <form enctype = "multipart/form-data" action = "{{= URL()}}" method = >>>> "post" class="hidden"> >>>> <select data-conv-question="Hello! >>>> I'm a bot created from a HTML form. Can I show you some features? (this >>>> question comes from a select)"> >>>> <option value="yes">Yes</option> >>>> <option >>>> value="sure">Sure!</option> >>>> </select> >>>> <input type="text" name="message" >>>> data-conv-question="Alright! First, type one word e.g. 'exercise', or ask >>>> a >>>> question.|Okay! you can type one word e.g. 'Soy', or ask a question."> >>>> <input type="text" >>>> data-conv-question="{{=code}}" data-no-answer="true"> >>>> >>>> </form> >>>> >>>> However, as a test, when retrieving data to controller, the >>>> request.vars does not give me the immediate user posted data, instead the >>>> previous data posted. For example, if the user posts 'abcd', with the >>>> previous post having been '1234', I'll get '1234' returned and not 'abcd'. >>>> Is there a way of cleaning up request.vars and getting the CURRENT >>>> posted data? >>>> Thanks for the help, God bless! >>>> >>>> On Friday, July 6, 2018 at 12:49:23 PM UTC-4, Maurice Waka wrote: >>>>>> >>>>>> I've changed from method='GET' to method ='POST', name=message ' (the >>>>>> table name) etc. But I seem to have an issue with the highlighted part. >>>>>> It's still not posting. Could you please give an example of how this can >>>>>> work? >>>>>> <form action="" enctype="multipart/form-data" method="POST" >>>>>> class="hidden"> >>>>>> <select >>>>>> data-conv-question="Hello! I'm a bot created from a HTML form. Can I >>>>>> show >>>>>> you some features? (this question comes from a select)"> >>>>>> <option >>>>>> value="yes">Yes</option> >>>>>> <option >>>>>> value="sure">Sure!</option> >>>>>> </select> >>>>>> <input type="text" >>>>>> name="message" data-conv-question="Alright! First, type one word e.g. >>>>>> 'exercise', or ask a question.|Okay! you can type one word e.g. 'Soy', >>>>>> or >>>>>> ask a question."> >>>>>> >>>>> >>>>> What exactly is the problem with that line? What are you expecting and >>>>> what do you observe? >>>>> >>>>> Note, if you're using SQLFORM, you'll need to include >>>>> {{=form.custom.end}} to make sure the hidden formname and formkey fields >>>>> are included. Please read the documentation. >>>>> >>>>> 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/ohTduB-ui7U/unsubscribe. >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> web2py+un...@googlegroups.com <javascript:>. >>>>> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/ohTduB-ui7U/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+un...@googlegroups.com <javascript:>. >> 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.