Tag: 表单

节点js – redirect到URL的forms发布数据

我是NodeJS的新手。 我想发送数据到页面redirect多个参数,如html格式如下: <form action="https://example.com/payment.aspx" method="post"> <input type="hidden" name="Amount" value="5000"/> <input type="hidden" name="ResNum" value="sdsadasd231323"/> <input type="submit" id="startBankPayment" class="btn btn-lg btn-success col-md-5" value="startPayment"/> </form> 我需要一个示例代码发送数据到URL和redirect到这个URL像表单提交button点击?

POST请求res.redirect()不起作用

这是我的邮政路线。 当我提交表格时,基本上只是拖延了。 该post正在向服务器发送,但响应(redirect)不会被发送回客户端。 app.post('/signup', function(req, res) { var customer = req.body.customer; var newCustomer = { "first_name": customer.first_name, "last_name": customer.last_name, "email": customer.email, "password": customer.password, "phone": customer.phone, "address": `${customer.address} ${customer.appt}`, "city": customer.city, "state": customer.state, "zip": customer.zip, "country": "US", "gateway_type": "PayWhirl Test Gateway", "gateway_id": 4133, "currency": "USD", "metadata": customer.referral } paywhirl.Customers.createCustomer(newCustomer, function() { if(err) { console.log(err); res.redirect('/', {err: […]

获取node.js上的文本字段的值

我想写一个简单的程序只与node.js(我不想使用angular度或另一个js框架),其中包含一个文本字段。

Angularjs不提交数据

我正在创build一个MEAN栈应用程序,我一直在使用Amos Q. Haviv的“Mean Web Development”一书来帮助我。 我碰到一个问题,我有一个表单,假设提交一个配方,但是当我检查数据库的条目是在那里与一个id,date和作者,但没有标题,mainImage,内容,类别或标签。 过去几天我一直试图自己弄清楚,再看一遍,看看我是否犯了错误,但没有运气。 这是我的模型: // Load the module dependencies var mongoose = require('mongoose'), paginator = require('mongoose-paginator'), Schema = mongoose.Schema; var CommentsSchema = new Schema({ commentor: String, data: { type: Date, default: Date.now() }, content: { type: String, default: ' ', trim: true, required: "Enter a comment into the comment box" }, […]

从angular度到节点POST数据不工作

我正在使用angular度发送数据到节点服务器,但它不工作。 我无法在我的节点发布方法中看到我的发布数据(表单中的input值)。 我需要将这些数据保存在mongoDb中,但是我不知道为什么我看不到前端发送的POST值。 我无法通过console.log()在节点中查看我的表单数据。 有时候它会返回{},有时POST会被'morgan'debugging器在我使用时识别为OPTIONS req console.log(req.body.fname); 我的Html: <body ng-app="app" ng-controller="MyController"> <div id="login-page" class="row"> <div class="col s12 z-depth-6 card-panel"> <form ng-submit="postData();"> <div class="row" style="height: 90px;background-color:#00BFA5;margin: -12px -12px 15px -12px"> <h3 class="center-align">Register</h3> </div> <div class="row margin"> <div class="input-field col s12"> <i class="mdi-social-person prefix"></i> <input id="fname" name="fname" ng-model="formData.fname" type="text" class="validate"> <label for="fname" class="center-align">First Name</label> </div> </div> <div […]

AngularJS将数据从multipartForm指令丢失到路由

我正在尝试构build一个Excelfile upload器,并parsingpath中的数据来存储它,但是在通过$ http服务路由发送的FormData中,数据会丢失。 我不知道该怎么做! 如果您有任何经验,请帮忙! Html查看: <form ng-controller="myCtrl"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" ng-model="myFile.name"> </div> <div class="form-group" > <input type="file" file-model="myFile.file"/> </div> <button ng-click="Submit()">upload me</button> </form> 控制器视图: myApp.controller('myCtrl', ['$scope', 'multipartForm', function($scope, multipartForm){ $scope.myFile = {}; $scope.Submit = function(){ var uploadUrl = '/upload'; multipartForm.post(uploadUrl, $scope.myFile); } }]); 服务视图: myApp.service('multipartForm', ['$http', function($http){ this.post = function(uploadUrl, […]

表单上的JS提交留在页面上

我知道这可能是一个简单的问题,并有一个教程的地方,但我似乎无法find它。 我使用express-generator生成了一个应用程序,并向路线添加了一个简单的表单 意见/ form.ejs <div> <h1>This is <%= name %></h1> <form action="/form" method="POST"> <input type="text" name="question" placeholder="question"><br> <input type="text" name="answer" placeholder="answer"><br> <input type="submit"> </form> 我想要做的是在表单提交后处理请求,而不对页面做任何事情。 基本上我希望它保持不变,所以我尝试了以下 路线/ index.js var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { res.render('index', { title: 'Express' }); }); router.get('/form', function (req, […]

如何禁用NodeJS中的buttonexpression?

我已经呈现了下面的表单,想要在第一次点击时禁用submit button ,以防止用户连续点击它。 如果可能的话,我想提交button消息从 我受够了 至 请稍候… 以下是视图代码 <!– Send email and update user –> <form method="post" action="/delivery/chooseBoxSelectedEmailUpdate"> <input type="hidden" name="boxCommand" value="{{command}}"> <input type="hidden" name="boxComport" value="{{comport}}"> <input type="hidden" name="boxCubbyId" value="{{cubbyId}}"> <input type="hidden" name="boxId" value="{{boxId}}"> <input type="hidden" name="userHashtag" value="{{userHashtag}}"> <button class="btn-primary-full" type="submit"> <i class="fa fa-cube" aria-hidden="true"></i> &nbsp;I'm done </button> </form> 以下是渲染代码 res.render('delivery/chooseBoxSelectedOpened', { title: 'Layoverbox', helpButtonURL: […]

如何在HTML表单中发回一个预设的数据字段?

我在一个Node.js网站上工作。 它保存有关某个省的地区的数据。 要编辑地区数据,pipe理员input地区的名称和年份,然后转到关于地区的具有各种字段的表单( /edit?district=blah&year=2010 )。 我应该如何跟踪在POST路线的范围内填写表格的地区和年份? 基本上我想用POSTforms发送当前URL参数中的数据。

HTML / JS表单被提交两次

我正在使用node.js / express创build一个网页。 我目前有一个表单有一些input和一个提交button,通过点击当前页面上的另一个button触发 这是我的表单的代码: <form name= "form" id="form-id" action="http://localhost:1337/process_post" method="POST"> <input type="hidden" name="hiddentext" id="textarea"/> <input hidden type="submit" name="submitbutton" id="submit_button"/> </form> 这是我的button(在onclick事件中触发提交表单被点击) <INPUT type="button" id="button-id" value="Save" onclick="this.disabled=true;load_page('form-id')" /> 这是我的JS脚本点击提交button function load_page(formId){ document.getElementById("submit_button").click(); } 我的问题是表单被提交两次。 我不确定为什么发生这种情况,以及如何解决这个问题。 有小费吗?