+ Start a Discussion
Manu ErwinManu Erwin 

Error: Cannot coerce '100%' to class java.lang.Integer - when using Apex scontrol tag

The Apex Pages component reference for 'scontrol' states for the 'Width' Integer attribute:
The width of the inline frame that should display the s-control, expressed either as a percentage of the total available horizontal space (for example width="80%"), or as the number of pixels (for example, width="600px").
When I attempt to set width="100%" I recieve the following error:
Error: Cannot coerce '100%' to class java.lang.Integer
Either the documentation is wrong or the conversion behind the scenes is not taking into account percentages.

For the moment I'm setting my width attribute to px but a percentage for width would be ideal.
Sorry this question got lost in the shuffle quite a while ago.

Percentage values for <apex:scontrol width> is supported in a rather bizarre (and incorrectly documented) way currently - if you specify a negative integer value it will be interpreted as the absolute value expressed as a percent. For example:

<apex:scontrol width="-100">

will result in the generated iframe element with a width="100%" attribute.

No support for percentage height is planned at this time.