Dynamically add questions data to html page, creating a survey application that dynamically forms the HTML page |
Dynamically add questions data to html page, creating a survey application that dynamically forms the HTML page |
uahmed90 |
Mar 26 2018, 03:23 PM
Post
#1
|
Group: Members Posts: 5 Joined: 26-March 18 Member No.: 26,614 |
Hi,
I'm working on a college project. I need to create a Survey application, and the part that I am stuck on is how to bring data into my html form from a database, dynamically? Basically, there are questions, and the answers, which the user will choose and both the questions and answers will be submitted into a database. That much I can do, but I cannot figure out how to bring the question itself from the database, and make it appear in the HTML page. For example: Question: <input type="text" id="ques">, this will give me the form field to input the answer to the question and program the submit button to send both question and answer to the database, but how do I RETRIEVE the QUESTION itself, from the database? the Question: <input type="text" id="ques">, this is what I want to bring in from the database. Also, I am using a firebase database, so if possible, please answer in reference to that, if not thats no problem. I can figure that part out if I can understand how to do that in html. THanks |
CharlesEF |
Mar 30 2018, 09:42 PM
Post
#2
|
Programming Fanatic Group: Members Posts: 1,981 Joined: 27-April 13 From: Edinburg, Texas Member No.: 19,088 |
I looked over your files. The JSON file is missing entries and it even has 1 or 2 duplicates. Your HTML file has so many errors I don't think it would submit correctly. Example: The select element doesn't have an action attribute, but you use it. Not 1 of the radio buttons have a value attribute. When a page is submitted name/value pairs are sent to the server. With no value attribute then the value is never sent to the server?
Based on the JSON file there is no way to dynamically create the form. The best you can do is hard code 99% of the form then use javascript to insert the questions only. This post has been edited by CharlesEF: Mar 30 2018, 09:43 PM |
Lo-Fi Version | Time is now: 23rd April 2024 - 10:26 AM |