Table not displaying all of data entered
so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.
The table where you enter data:
<form id="symptomstable" name="symptomstable">
<table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
<th><b>Symptoms</b></th>
<tr>
<td><input type="text" name="sym1" size="100" id="sym1"></td>
</tr>
<tr>
<td><input type="text" name="sym2" size="100" id="sym2"></td>
</tr>
<tr>
<td><input type="text" name="sym3" size="100" id="sym3"></td>
</tr>
<tr>
<td><input type="text" name="sym4" size="100" id="sym4"></td>
</tr>
<tr>
<td><input type="text" name="sym5" size="100" id="sym5"></td>
</tr>
<tr>
<td><input type="text" name="sym6" size="100" id="sym6"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
</tr>
</table>
Where it outputs to:
<table width="900px" align="center" border=1>
<tr style="background-color:#BDDBCC;"></br>
<th align="center"><b>Symptoms Log</b></th>
</tr>
<tr>
<td align="center"><div id="symarea1"></div></td>
</tr>
<tr>
<td align="center"><div id="symyarea2"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea3"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea4"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea5"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea6"></div></td>
</tr>
</table>
The javascript:
function display1()
{
document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
document.getElementById("sym1").value = "";
document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
document.getElementById("sym2").value = "";
document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
document.getElementById("sym3").value = "";
document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
document.getElementById("sym4").value = "";
document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
document.getElementById("sym5").value = "";
document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
document.getElementById("sym6").value = "";
}
javascript html
add a comment |
so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.
The table where you enter data:
<form id="symptomstable" name="symptomstable">
<table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
<th><b>Symptoms</b></th>
<tr>
<td><input type="text" name="sym1" size="100" id="sym1"></td>
</tr>
<tr>
<td><input type="text" name="sym2" size="100" id="sym2"></td>
</tr>
<tr>
<td><input type="text" name="sym3" size="100" id="sym3"></td>
</tr>
<tr>
<td><input type="text" name="sym4" size="100" id="sym4"></td>
</tr>
<tr>
<td><input type="text" name="sym5" size="100" id="sym5"></td>
</tr>
<tr>
<td><input type="text" name="sym6" size="100" id="sym6"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
</tr>
</table>
Where it outputs to:
<table width="900px" align="center" border=1>
<tr style="background-color:#BDDBCC;"></br>
<th align="center"><b>Symptoms Log</b></th>
</tr>
<tr>
<td align="center"><div id="symarea1"></div></td>
</tr>
<tr>
<td align="center"><div id="symyarea2"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea3"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea4"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea5"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea6"></div></td>
</tr>
</table>
The javascript:
function display1()
{
document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
document.getElementById("sym1").value = "";
document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
document.getElementById("sym2").value = "";
document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
document.getElementById("sym3").value = "";
document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
document.getElementById("sym4").value = "";
document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
document.getElementById("sym5").value = "";
document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
document.getElementById("sym6").value = "";
}
javascript html
add a comment |
so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.
The table where you enter data:
<form id="symptomstable" name="symptomstable">
<table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
<th><b>Symptoms</b></th>
<tr>
<td><input type="text" name="sym1" size="100" id="sym1"></td>
</tr>
<tr>
<td><input type="text" name="sym2" size="100" id="sym2"></td>
</tr>
<tr>
<td><input type="text" name="sym3" size="100" id="sym3"></td>
</tr>
<tr>
<td><input type="text" name="sym4" size="100" id="sym4"></td>
</tr>
<tr>
<td><input type="text" name="sym5" size="100" id="sym5"></td>
</tr>
<tr>
<td><input type="text" name="sym6" size="100" id="sym6"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
</tr>
</table>
Where it outputs to:
<table width="900px" align="center" border=1>
<tr style="background-color:#BDDBCC;"></br>
<th align="center"><b>Symptoms Log</b></th>
</tr>
<tr>
<td align="center"><div id="symarea1"></div></td>
</tr>
<tr>
<td align="center"><div id="symyarea2"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea3"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea4"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea5"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea6"></div></td>
</tr>
</table>
The javascript:
function display1()
{
document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
document.getElementById("sym1").value = "";
document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
document.getElementById("sym2").value = "";
document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
document.getElementById("sym3").value = "";
document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
document.getElementById("sym4").value = "";
document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
document.getElementById("sym5").value = "";
document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
document.getElementById("sym6").value = "";
}
javascript html
so I have this table form that when you hit submit, it should display the information entered. but it only displays the first input entered. I have another table just like this one that works fine, so it must be a small thing that I'm just not seeing.
The table where you enter data:
<form id="symptomstable" name="symptomstable">
<table class="symptoms" width="700px" bgcolor="#BDDBCC" border="3" align="center">
<th><b>Symptoms</b></th>
<tr>
<td><input type="text" name="sym1" size="100" id="sym1"></td>
</tr>
<tr>
<td><input type="text" name="sym2" size="100" id="sym2"></td>
</tr>
<tr>
<td><input type="text" name="sym3" size="100" id="sym3"></td>
</tr>
<tr>
<td><input type="text" name="sym4" size="100" id="sym4"></td>
</tr>
<tr>
<td><input type="text" name="sym5" size="100" id="sym5"></td>
</tr>
<tr>
<td><input type="text" name="sym6" size="100" id="sym6"></td>
</tr>
<tr>
<td align="center"><input type="button" value="Submit" name="submit" id="submit" onClick="display1()"/></td>
</tr>
</table>
Where it outputs to:
<table width="900px" align="center" border=1>
<tr style="background-color:#BDDBCC;"></br>
<th align="center"><b>Symptoms Log</b></th>
</tr>
<tr>
<td align="center"><div id="symarea1"></div></td>
</tr>
<tr>
<td align="center"><div id="symyarea2"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea3"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea4"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea5"></div></td>
</tr>
<tr>
<td align="center"><div id="symarea6"></div></td>
</tr>
</table>
The javascript:
function display1()
{
document.getElementById("symarea1").innerHTML = document.getElementById("sym1").value;
document.getElementById("sym1").value = "";
document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
document.getElementById("sym2").value = "";
document.getElementById("symarea3").innerHTML = document.getElementById("sym3").value;
document.getElementById("sym3").value = "";
document.getElementById("symarea4").innerHTML = document.getElementById("sym4").value;
document.getElementById("sym4").value = "";
document.getElementById("symarea5").innerHTML = document.getElementById("sym5").value;
document.getElementById("sym5").value = "";
document.getElementById("symarea6").innerHTML = document.getElementById("sym6").value;
document.getElementById("sym6").value = "";
}
javascript html
javascript html
asked Nov 27 '18 at 23:02
Jackie Jackie
615
615
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.
Check out how to use the console in Firefox and Chrome
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509562%2ftable-not-displaying-all-of-data-entered%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.
Check out how to use the console in Firefox and Chrome
add a comment |
You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.
Check out how to use the console in Firefox and Chrome
add a comment |
You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.
Check out how to use the console in Firefox and Chrome
You just have a typo. If you open up your console after trying to submit the form, you will see that you have an error that says Cannot set property 'innerHTML' of null. If you look at the line it refers to, you will see that it references document.getElementById("symarea2").innerHTML = document.getElementById("sym2").value;
In your HTML, the ID of this element is currently symyarea2. See: <td align="center"><div id="symyarea2"></div></td>.
Check out how to use the console in Firefox and Chrome
answered Nov 27 '18 at 23:27
Katie.SunKatie.Sun
587114
587114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53509562%2ftable-not-displaying-all-of-data-entered%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown