Materialize-stepper表单没有使用nodejs提交到MySql数据库

时间:2017-10-17 15:03:11

标签: jquery mysql node.js ecmascript-6 materialize

我有一个大的html表单,所以我决定使用materialize-stepper来促进UI。但是表单没有提交给MySql数据库。我尝试使用普通表单,输入很少,然后提交给数据库。我在想,是不是因为'ul'标记?我的代码在下面

Html表单的片段:

    <form class="CreateClient">
      <ul class="stepper horizontal" style="min-height:550px">
         <li class="step active">
           <div class="step-title waves-effect waves-dark">Contact detail</div>
              <div class="step-content">
                 <div class="row">
                 <div class="input-field col s12">
                   <i class="fa fa-user prefix"></i>
                   <input id="icon_prefix" type="text" class="first_name validate" required>
                   <label for="icon_prefix">First Name</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="fa fa-user prefix"></i>
                   <input id="icon_prefix" type="text" class="surname validate" required>
                   <label for="icon_prefix">Surname</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="material-icons prefix">place</i>
                   <input id="icon_place" type="text" class="address validate" required>
                   <label for="icon_place">Address</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="material-icons prefix">local_post_office</i>
                   <input id="icon_post" type="number" class="post_code validate" required>
                   <label for="icon_post">Postcode</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="material-icons prefix">phone</i>
                   <input id="icon_telephone" type="tel" class="telephone validate">
                   <label for="icon_telephone">Daytime Telephone</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="material-icons prefix">phone_iphone</i>
                   <input id="icon_telephone" type="tel" class="mobile validate">
                   <label for="icon_phone_iphone">Mobile</label>
                 </div>
                 <div class="input-field col s12">
                   <i class="material-icons prefix">email</i>
                   <input id="icon_email" type="email" class="email validate">
                   <label for="icon_email">email</label>
                 </div>
               </div>
                 <div class="step-actions">
                   <button class="waves-effect waves-dark btn" type="submit">Submit
                   <i class="material-icons right">send</i>
                   </button>

这是引用类

的节点应用程序
    const CreateClient = document.querySelector('.CreateClient')
    CreateClient.addEventListener('submit', (e) => {e.preventDefault()
    const firstName = CreateClient.querySelector('.first_name').value
    const surname = CreateClient.querySelector('.surname').value
    const address = CreateClient.querySelector('.address').value
    const postCode = CreateClient.querySelector('.post_code').value
    const telephone = CreateClient.querySelector('.telephone').value
    const mobilePhone = CreateClient.querySelector('.mobile').value
    const email = CreateClient.querySelector('.email').value

这些代码是否编写良好,是否选择了类?如果不是我使用的插件的问题。我对这些都很陌生。请帮帮我

0 个答案:

没有答案