[SalesForce] Visualforce Page: Error for Input Type Number: Unable to validate type ‘number’: data type not provided

I tried using <apex:input type="number" /> in VisualForce page, however, it gives an error of:

Unable to validate type 'number': data type not provided

I've already put docType="html-5.0" in <apex:page>, put the input in an <apex:form>. I'm even using API version 38 in Developer Console. Below is the full code:

<apex:page docType="html-5.0">
    <apex:form>
        <apex:input type="number" />
    </apex:form>
</apex:page>

The code above won't even allow me to save.

Best Answer

apex:input expects a property in value field, following code is working fine:

Controller:

public class Html5Input {
    public Integer accountNumber { get; set; }
}   

Page:

<apex:page docType="html-5.0" controller="Html5Input">
    <apex:form>
        <apex:input type="number" value="{!accountNumber}"/>
    </apex:form>
</apex:page>
Related Topic