You need to sign in to do that
Don't have an account?

Map values in the new HTML 5 apex:input field
I'm having trouble using the new html5 compliant apex:input field. I'm working with maps and trying to set a number in the value part of the map, related to a corresponding Id key. The map is called "prodQty" and an entry in the map might look like {XXXXXXXXXXXXXXXXXX,10} so the Key is an Id and the value is a number.
Here is a sample of what works using a normal input:text field:
<apex:inputText value="{!prodQty[p.Id]}" />
All this does on the VF page is simply create an inputText field and display the corresponding number from the map. I can change that number and it updates the map no problem.
I wanted to use the HTML5 number type and so set it up with this code:
<apex:input type="number" value="{!prodQty[p.Id]}" />
Looks pretty standard to me, but I get this error:
Expected input type 'text', got 'number' for Id data type
It seems to be pulling through the key of the map rather than the value which is odd, because with a standard inputText component the value syntax works perfectly so why does the new component not recognise that I'm pulling through a number instead of an Id? Is it impossible to use this new component with a map value? It'll be an unfortunate limitation if that's the case!
Thanks for any advice.
One more thing, I've tried to set the value attribute with a variable, hoping that the variable would do the work in pulling back the map's value (a number) and then the input would just display it:
but then I get:
Input type 'number' does not support ANY data type. Try settng type to 'text'
Just found a solution.
You need to set the type of <apex:input> to auto it will get rendered as Number field.
<apex:Input type="auto" value="{!map[key]}"/>
map[key] must be of type Integer.