After removing the .. onclick='myFunction()';, it now works well
On Saturday, May 30, 2020 at 10:21:04 AM UTC+3, Maurice Waka wrote: > > I'm getting a 'None' value when posting an array to controller (array > posted db). What could I be doing wrong? > Here is my code > > <select name="result" id="result" question="Click on the button below to > know your answer."> > <option value="my result" onclick='myFunction();'>Yes</option> > <option value="no result">No</option> > </select> > <script type="text/javascript"> > function myFunction();{ > var result = ["bat", "cat", "dog", "sun", "hut", "run"]; > ajax('{{=URL('chat', 'synchptoms')}}' + '?result=' + result, > [], ':eval'); > } > </script> > > controller > > @auth.requires_login() > def synchptoms(): > value = request.vars.result#json(request.body.read()) > array = [1, 2, 3, 4, 5] > db.answers.insert(message=value) > return dict(array=json(array),value=value) > > -- 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/67d60883-5815-4b45-b63e-4206cd9f1709%40googlegroups.com.