0

我已经这样实现intl-tel-input

    var ppvar;

    function primaryPhoneDisplay(assignedName){
      let countryPhoneNumer = document.querySelector(`input[name="${assignedName}"]`);
      ppvar = window.intlTelInput(countryPhoneNumer, {
          separateDialCode: true,
          initialCountry: "IN",
          preferredCountries: ["IN"],
          nationalMode: false,
          hiddenInput: "primary_phone_test",
          formatOnDisplay: false,
          utilsScript:'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/14.0.6/js/utils.js'
      });
    }

    primaryPhoneDisplay("primaryPhone");

HTML是这样的

<form action="/formsubmit" method="POST" onsubmit="return formSubmit()">

 <input type="text" name="primaryPhone" class="form-control"   oninput="someFunction(this)" placeholder="Phone Number" />

 <input type="submit" value="Submit" />
</form>

inspecting源中出现隐藏字段,但在提交表单时,这些字段在 中丢失,req.body除此之外所有其他字段都在那里。

代码有什么问题吗?

4

0 回答 0