Can not check if checkbox is checked with node js
I need to check if checkbox is checked using node js. I tried, but in any case code do things after else. It doesn't realy "see" is it checked or not
<input type="checkbox" name="ch1" id="ch1"ng-model="ch1">
//------------------------------------------
router.post('/', function(req, res)
if(req.body.ch1) ...one thing;
else ...enother thing;
);
javascript node.js angular
add a comment |
I need to check if checkbox is checked using node js. I tried, but in any case code do things after else. It doesn't realy "see" is it checked or not
<input type="checkbox" name="ch1" id="ch1"ng-model="ch1">
//------------------------------------------
router.post('/', function(req, res)
if(req.body.ch1) ...one thing;
else ...enother thing;
);
javascript node.js angular
1
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
Probable reason is you don't have avalue
html attribute set but that's just speculation without having the code that does the submission.
– itsundefined
Nov 12 '18 at 22:28
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
Selected state is done client side through thechecked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code likehttp.post()
if using Angular'shttp
module
– Patrick Evans
Nov 12 '18 at 23:03
add a comment |
I need to check if checkbox is checked using node js. I tried, but in any case code do things after else. It doesn't realy "see" is it checked or not
<input type="checkbox" name="ch1" id="ch1"ng-model="ch1">
//------------------------------------------
router.post('/', function(req, res)
if(req.body.ch1) ...one thing;
else ...enother thing;
);
javascript node.js angular
I need to check if checkbox is checked using node js. I tried, but in any case code do things after else. It doesn't realy "see" is it checked or not
<input type="checkbox" name="ch1" id="ch1"ng-model="ch1">
//------------------------------------------
router.post('/', function(req, res)
if(req.body.ch1) ...one thing;
else ...enother thing;
);
javascript node.js angular
javascript node.js angular
asked Nov 12 '18 at 22:17
k_bmk_bm
11
11
1
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
Probable reason is you don't have avalue
html attribute set but that's just speculation without having the code that does the submission.
– itsundefined
Nov 12 '18 at 22:28
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
Selected state is done client side through thechecked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code likehttp.post()
if using Angular'shttp
module
– Patrick Evans
Nov 12 '18 at 23:03
add a comment |
1
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
Probable reason is you don't have avalue
html attribute set but that's just speculation without having the code that does the submission.
– itsundefined
Nov 12 '18 at 22:28
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
Selected state is done client side through thechecked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code likehttp.post()
if using Angular'shttp
module
– Patrick Evans
Nov 12 '18 at 23:03
1
1
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
Probable reason is you don't have a
value
html attribute set but that's just speculation without having the code that does the submission.– itsundefined
Nov 12 '18 at 22:28
Probable reason is you don't have a
value
html attribute set but that's just speculation without having the code that does the submission.– itsundefined
Nov 12 '18 at 22:28
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
Selected state is done client side through the
checked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code like http.post()
if using Angular's http
module– Patrick Evans
Nov 12 '18 at 23:03
Selected state is done client side through the
checked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code like http.post()
if using Angular's http
module– Patrick Evans
Nov 12 '18 at 23:03
add a comment |
0
active
oldest
votes
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%2f53270899%2fcan-not-check-if-checkbox-is-checked-with-node-js%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f53270899%2fcan-not-check-if-checkbox-is-checked-with-node-js%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
1
How are you sending the data, ie show the code that sends it. Also the data sent is usually just the value of the checkbox(es) selected not its checked state.
– Patrick Evans
Nov 12 '18 at 22:20
Probable reason is you don't have a
value
html attribute set but that's just speculation without having the code that does the submission.– itsundefined
Nov 12 '18 at 22:28
@PatrickEvans do you know how to check its selected state?
– k_bm
Nov 12 '18 at 22:44
@itsundefined, added attribute value="ch1", did not help
– k_bm
Nov 12 '18 at 22:46
Selected state is done client side through the
checked
property. Again this information is not usually sent to the server the value of the checked box is. That is why you need to show the code that you use to send the information, ie the ajax code likehttp.post()
if using Angular'shttp
module– Patrick Evans
Nov 12 '18 at 23:03