繁体   English   中英

node.js / jade无法通过表单调用传递值

[英]node.js / jade not able to pass values with form calls

我正在尝试使用“开箱即用”的应用程序来与node.js 0.8.0一起使用(它是在0.6.x中设计的,但我无法获得与此相关的依赖项)。

我已经使用发现的视图更新了大多数错误,但是在通过表单字段传递变量时遇到了麻烦。

登录页面:

extends ../layout

block scripts
  include ../includes/js/jquery
  include ../includes/js/center
  include ../includes/js/focus
  include ../includes/js_form

block content

  include ../includes/logo

  .main

    h1 Welcome to <br> #{company_name} #{company_location}!
    br
    h2 Please sign in / sign out.
    br

    form(action='check_signout', method='post', id='name_form', autocomplete='off')
      p What is your first name?
      input(type='text', id='first_name', name='first_name', size='40', class='required', minlength='1')
      br
      br
      p And your last name?
      input(type='text', id='last_name', name='last_name', size='40', class='required', minlength='2')
      br

      include ../includes/next

  include ../includes/page_number

check_signout(表单提交页面):

extends ../layout

block scripts
  include ../includes/js/jquery
  include ../includes/js/center
  include ../includes/timeout

block content

  include ../includes/logo

  .main

    h2 &nbsp;

    p Hi, #{first_name} #{last_name}!
    p You signed in at #{signin_time}.
    p Would you like to sign out?

    br
    br
    br

    p
      input.button#signout(type="button", value="Yes, I would like to sign out.", onclick="parent.location='confirm_signout'", readonly)

    br
    br

    p
      input.button(type="button", value="No, I would like to sign in.", onclick="parent.location='reason'", readonly)

错误:

Express
500 TypeError: Cannot set property 'first_name' of undefined
at exports.check_signout (/home/ubuntu/lobby/routes/index.js:24:31)
at callbacks (/home/ubuntu/lobby/node_modules/express/lib/router/index.js:165:11)
at param (/home/ubuntu/lobby/node_modules/express/lib/router/index.js:139:11)
at pass (/home/ubuntu/lobby/node_modules/express/lib/router/index.js:146:5)
at Router._dispatch (/home/ubuntu/lobby/node_modules/express/lib/router/index.js:173:5)
at Object.router (/home/ubuntu/lobby/node_modules/express/lib/router/index.js:33:10)
at next (/home/ubuntu/lobby/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at Object.methodOverride [as handle] (/home/ubuntu/lobby/node_modules/express/node_modules/connect/lib/middleware/methodOverride.js:37:5)
at next (/home/ubuntu/lobby/node_modules/express/node_modules/connect/lib/proto.js:190:15)
at store.get.next (/home/ubuntu/lobby/node_modules/express/node_modules/connect/lib/middleware/session.js:302:9)

您的html代码看起来不错,但是错误在node.js代码上。

首先发布node.js代码。

显示错误500,这是一个“代码错误”,请检查node.js中的参数是否正确编码,还请检查发布请求处理代码是否正确。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM