Sandy DK Sandy DK - 3 years ago 292
PHP Question

Bootstrap Form Input Float Value Issue

I have used bootstrap 4 framework in my website. Using this framework I have created a simple html form using bootstrap class with javascript function.

The form works good while i enter integer as input, But it shows some error while i enter float vales.

Here is the web-page.

<form role="form" name="BeamFactor">
<div class="form-group">
<label>Antenna dimension (D) :</label>
<input class="form-control input-lg" name="n1" required="" type="number">
</div>
<div class="form-group">
<label>Wavelength (λ) :</label><input class="form-control input-lg" name="n2" type="number">
</div>

<div class="form-group">
<label>Beamwidth :</label><input class="form-control input-lg" name="n3" type="number">
</div>

<div class="form-group">
<input value="Calculate" class="btn btn-success btn-lg" onclick="javascript:calcBeamFactor();" type="button">
<button type="reset" class="btn btn-warning btn-lg">Reset</button>
</div>

<div class="form-group">
<label>BF :</label><input class="form-control input-lg" name="total">
</div>
</form>

Answer Source

Add step property to your input type.

<input type="number" step="any" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download