I am trying to create a website using Django, python and sql server which lists out the items in a tabular form. And upon selection of particular item via check box i want to update my database table with selected items.
For eg: in the image below if ID : n1234 is selected i want to update backend table with drugsdispensed
I am trying to learn Django and Python.
HTML File :
loop through the object and save it in the database :
I know there is a better of doing the same thing looking for comments
Related
I need to build a website with the following types of data input table.
I want to use html, css, js and bootstrap for the frontend and Django for the backend and SQLite also as Django's default database system. Now I am confused about what is the standard way to implement this type of input table's frontend. I can generally implement a table and inside the cell(means inside <td> tag) I can put another <input> tag to take input data and send it in the database from the user). Or I can use an editable table (Actually I do not know if it is possible to use this type of editable table to send data in the database or not).
Here I need an add row button and delete row icon also like the picture to add/remove the input row if needed, and I don't know how to implement it also thus it will easily reachable from the backend.
So please suggest to me what is the best way and how I should implement this frontend thus I won't be trouble to implement this website's backend also.
You can think of saving the table cell data to the backend on blur.
For this you might need to post data without submitting the form.
You can create an invisible form and submit the edited cell data of the form on every blur with row and column value to backend. You can trigger the submission of form programmatically and doing a prevent default to avoid page redirect.
On loading of the page you can get the whole data and use the framework to create table.
I prepare to perform a simple project and I don’t know what I should use to accomplish this. I need to receive a data entered by a user (via a webpage) and store them somewhere. I need them to be able to search and returned on the user request. I’m a little old-fashioned so I assumed that should be a file on ftp managed by some python or JS script? I really don’t know where to start so please advise.
project
Have you considered storing data in a database?
You can use MySQL. It's quite simple after you understand how a database table works.
Data are stored in a table. Table is a part of a database with other tables.
Each table has columns you create. Data are added to the table in rows.
For example, let's say a user sends you their name 'Brian'.
You can have a table called 'users'. In that table, you can create a column 'id' of the user (read about it later, including auto incrementing), and 'name'.
You insert the data into that table. Brian is now in a table with his own ID, like this:
id Name
----------------
1 Brian
Check this out:
SQL tutorial
Possible solution i would recommend:
create a mysql server
create a backend (links for Java)
rest-service https://spring.io/guides/gs/rest-service/
access DB https://docs.spring.io/spring-data/jpa/docs/1.5.0.RELEASE/reference/html/repositories.html
put the parts together
get/save the data on your webpage with xhr2.
I've made myself a dynamic form builder using jquery ui that the the user can drag form inputs to wherever they like on the screen and create a report. Now I'm looking to save this to a SQL database. What would be the best way in going about saving the layout of this form and creating a database table from it that the user can then fill in reports and submit them to the database.
How would I go about saving the HTML elements styles like transformations etc. I'd need these as I would like to be able to take an existing form and recreate it if it needs anything to be added/removed.
Would appreciate any suggestions.
How about arrange its fields and data into XML format or JSON then save it to database. You can use XML datatype column for XML format and varchar for JSON in Database.
I am using Tag functionality of select 2 in my spring application and hibernate to save it. I am using the AJAX call to save this form.
Till here it is working fine.
My problem is:
How can I populate the data from DB and display it in screen as tag so that user can update it. (this data has id and text)?
How can I save this data in DB using AJAX call. Basic form is saving but for this select2 data I am able to get only keys. I need proper Entity so that I can save/update it directly in DB?
an example will be very much appreciated. right now, I am not putting my code there. Please comment n this post if you want me to post any code.
FYI: I am new in spring and hibernate.
How do you populate text fields using AJAX from JSP scriptlet with data obtained from Oracle 10g database? How do you get a handle on those input elements of type text from a jsp? Using javascript? but how do you use the values in the scriptlet?
Thanks
Not sure if I understand what you mean.
You have JSP page that reads data from DB and some other page with text inputs. You want to populate these inputs with data from JSP using AJAX call, right ? So just write javascript that will hit JSP page and get a response in JSON format with data from DB and then populate the input fields.
If I am understanding your question right : Why not use a javascript templating engine and just populate and render the template with the json response? If you haven't used templates like this, I would probably investigate. There are quite a few options out there, Mustache is a decent one : http://mustache.github.com/. http://coenraets.org/blog/2011/12/tutorial-html-templates-with-mustache-js/