node.js - 勾选带有 nodejs 发布请求的单选按钮
问题描述
我正在尝试使用单选按钮进行发布请求。HTML 页面是一个有 2 个单选按钮的表单:
<form name="create" class="jqTransform FormValidate" id="MyForm" action="/My/Form/1" method="post">
<p class="a"><input type="radio" class="radio" value="1" name="choices" id="18" /><label for="r1">Radio button r1</label></p>
<p class="a"><input type="radio" class="radio" value="2" name="choices" id="r2" /><label for="r2">Radio button R2</label></p>
<input type="submit" class="Bbutton" title="Click here to go to next step" value="next step" name="nextStep" />
我想在这样的帖子请求中选择 R1 或 R2:
request({
url: url,
method: 'post',
form: {
//Here maybe ? something to add for checking a radio button?
nextStep: 'next step',
},
headers: {
'User-Agent': 'MyUserAgent',
'Referer': 'https://myurl/My/Form/1'
},
jar: jar
}, function(err, response, body) {do something after}
我知道可以勾选一个复选框
condition: 'on'
在请求表单参数里面。但我不知道如何继续检查单选按钮。
任何帮助表示赞赏!谢谢你。
解决方案
对不起,我是 nodejs 的菜鸟。
回答 :
choices : 1
表格内。
推荐阅读
- reactjs - 如何将道具传递给 React Big Calendar 自定义组件?
- sql - 有没有办法检查一个表是否包含答案表中某一列中一个特定 ID 的所有记录?
- html - 边界半径 50% 和 100% 有什么区别?
- css - 使用Angular Material从mat-card-content中选择mat-radio按钮时如何为mat-card添加背景?
- python - KivyMD App ScrollView 超出边界
- javascript - 如何获取角管道中过滤记录的计数
- php - 如何为 Laravel 模块架构应用 CRUD 生成器?
- ios - 如何让单元格中的内容视图占据整个单元格?
- amazon-web-services - 未为 ALB 侦听器列出导入的 SSL 证书
- bash - 使用带有 readline 的选择菜单时忽略箭头键