7

I'm trying to use HTML5 and the Winter'14 support for it (code sample if you haven't seen it yet).

It works fine for type="auto", but not for type="range". I'm trying to bind to an Integer and I'm getting this error:

Expected input type 'number', got 'range' for Decimal data type 

Any ideas?

Here's simple piece of code to reproduce it (make sure the VF page is saved at least in v.28).

public class html5 {
    public Integer anInt {get;set;}
    public String aString {get;set;}

    public html5(){
        anInt = 0;
        aString = '0';
    }
}
<apex:page controller="html5" doctype="html-5.0" readonly="true" tabStyle="Account">
    <apex:form>
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:input label="this works" value="{!anInt}" type="auto" html-min="0" html-max="30" html-step="1" />
            <apex:input label="this throws" value="{!anInt}" type="range" html-min="0" html-max="30" html-step="1" />
            <apex:input label="this throws too" value="{!aString}" type="range" html-min="0" html-max="30" html-step="1" />
        </apex:pageBlockSection>
    </apex:pageBlock>
    </apex:form>
</apex:page>

I've tried faking it by overriding the type in the pass-through (html-type="range"), no luck. I know I can always use JS to create the slider or use hacks from other questions (like raw html5 input + JS sync to the hidden one on submit)... But would be nice to have.

Seems like HTML5 support is half-baked yet.

8
  • Did you try to use Decimal instead of Integer?
    – brovasi
    Dec 8, 2013 at 23:27
  • 1
    What browser? I read that IE has issues with the HTML range element.
    – JimRae
    Dec 9, 2013 at 4:13
  • @JimRae any, it's a compilation error. Still, good to know, that might mean I shouldn't spend too much time trying to get it to work ;)
    – eyescream
    Dec 9, 2013 at 9:00
  • @brovasi same error
    – eyescream
    Dec 9, 2013 at 9:37
  • Maybe it should be logged with support. I found an article about implementing it and the author had the same problem.
    – JimRae
    Dec 9, 2013 at 11:51

1 Answer 1

5

Edit

It indeed works in Spring'14. Doesn't look very exciting if used standalone but then the slider was designed with imprecise control in mind so I guess I shouldn't complain ;)

Here's how it looks with a client-side output hooked to it:

enter image description here

<apex:page controller="html5" doctype="html-5.0"
    showHeader="false" standardStylesheets="false" id="page">
    <apex:form id="form"
        html-oninput="out.value = document.getElementById('page:form:range').value">
        <apex:input id="range" value="{!anInt}" type="range" 
            html-min="0" html-max="30" html-step="1" />
        <output name="out">0</output>
    </apex:form>
</apex:page>

Original:

Just got a call & case closed comment from SF Dev Support representative.

Case #09986593

(..) please allow me to confirm that our Research & Development team is working on the issue and indeed is scheduled to be fixed in the upcoming Spring '14 release, which you can test in any sandbox upgrades during January.

So not long to wait now (sandboxes refreshed before Jan 3rd should get it)...

3

You must log in to answer this question.

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