我已经这样实现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
中的字段丢失,除此以外的所有其他字段都在其中。
代码有什么问题吗?