I have implemented intl-tel-input
like this
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");
The HTML
is like this
<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>
On inspecting
the hidden fields appear in the source but on submission of the form, the fields are missing in the req.body
, All other fields are there except this.
Is there anything wrong with the code?