get data from tabel and send to view

2013-03-13 Thread Gert V
We use pyramid and chameleon template. Currently we have a page where users can fill in a table. This table has a variable lenght because rows are added dynamically. We want to get all the content of the table and put it in a list, so we send it to our database. The biggest problem is that we do

Re: get data from tabel and send to view

2013-03-13 Thread Vincent Catalano
Can you be a bit more specific with what you are attempting to do? Have you created a form with input fields throughout this table? Are you posting the form data to your pyramid application? -Vincent On Wed, Mar 13, 2013 at 8:42 AM, Gert V wrote: > We use pyramid and chameleon template. > > Cu

Re: get data from tabel and send to view

2013-03-13 Thread Gert V
Thanks for the fast reply. sorry i wasn't clearer on my previous post. If annything is still not documentated enough please let me know. i'll give some code snippets of my template. no data is loaded into this page. the user has to fill in a few fields and after that we want to store it to our d

Re: get data from tabel and send to view

2013-03-13 Thread Vincent Catalano
I would recommend spending some more time reading the Pyramid documentation, especially how Pyramid handles form posts with View Callables: http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/narr/views.html#handling-form-submissions-in-view-callables-unicode-and-character-set-issues . -V

Re: get data from tabel and send to view

2013-03-14 Thread cropr
Gert, What you could do is the following. Make on the client in javascript a datastructure (probably a list), that has all the relevant data from the table. Do a JSON.stringify() on a the data structure and send the resulting string to the webserver either using a hidden field in a form, ei

Re: get data from tabel and send to view

2013-03-14 Thread xinfa tang
You can submit a form with multiple records(this's how checkbox works), because you data is come from a html table, not in input control, you need collect all your data in json(take a loook at jquery.ajax) and build a form submit you wanted, the pyramid side will decode the form submit normally,

Re: get data from tabel and send to view

2013-03-15 Thread Gert V
Thx for all previous reactions. We got all our tabledata into a json. It looks like this: function neeminhoud() { var headers = []; var InputsArray = []; var Data = []; var oTable = document.getElementById('tableDiagnose'); var rijen = oTabl

Re: get data from tabel and send to view

2013-03-16 Thread Gert V
we added these lines in our views.py def get_items(request): return {request} @view_config(route_name='diagnose', xhr=True, renderer='json') def r_ajax(request): items = get_items(request) logger = logging.getLogger("random") logger.warning(json.dumps(items)) our ajax post lo

Re: get data from tabel and send to view

2013-03-16 Thread Gert V
We managed to set up a ajax request with our data inside. We get the succes message, but we don't know how to get the json out of our ajax request. We added these lines in our views.py def get_items(request): return {request} @view_config(route_name=' diagnose', xhr=True, renderer='json')

Re: get data from tabel and send to view

2013-03-16 Thread Malthe Borch
This is related to jQuery, not the Python framework that you're using. Note that the `success` function receives more arguments than just the message. \malthe On 16 March 2013 17:09, Gert V wrote: > We managed to set up a ajax request with our data inside. > We get the succes message, but we do