Does apex:inputHiddenhave any kind of length or limit?

I am using it to capture displayed error messages and in theory there is nothing to stop the user from generating message after message.

I have checked the offical docs below and can't see any mention of limits: https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputHidden.htm

1 Answer 1


A string is a string is a string as far as Apex is concerned. You don't say where the error messages are coming from, so this is more of a generic answer. Problems would only arise if you run into heap space issues when the page's contents are transferred to the controller as error messages are generated in the browser (if that's the source) and stored on the controller side or should you run into memory issues in the user's browser.

The latter isn't especially likely on a modern machine unless the user has a lot of tabs open, but the former would be with Visualforce's view state limitations of 128k, even though the fields aren't being displayed. That's because the values would be held in memory by the controller until processed or cleared. If using transient variables to transmit them to the user's browser from Salesforce, then clearing them in the controller, you'd presumably be fine if you didn't want to keep them.

  • That's pretty much what I was thinking. The messages are generated via javascript and isn't likely that a string longer than 100 characters will be generated but it just got me thinking while testing it. I might try hammering it and see what happens.
    – Girbot
    Commented Nov 26, 2015 at 16:37

You must log in to answer this question.

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