1

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.

2 Answers 2

4

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>
1
  • Thank you for the answer. You are right. I really have to deal with putting it a value. Nov 14, 2016 at 2:56
2

Just delete apex: part on the tag if you want to go this way.

OR: It will give you the same error for every type since there is no Value attribute on your tag.So it says, data type not provided. Create any number variable on your class an assign it to this tag via Value attribute.

1
  • Yeah, it worked. I mean, I just deleted the apex part. But, I've also pounded that I can't save the value since it is not tied the controller. Anyway, thank you! Nov 14, 2016 at 2:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .