Sunday, June 15, 2014

How to use apex:inputHidden in Visualforce Page?

How to use <apex:inputHidden>  in Visualforce Page?

<apex:inputHidden>:
An HTML input element of type hidden, that is, an input element that is invisible to the user. Use this component to pass variables from page to page. 

Syntax:
<apex:inputHidden value="{!inputValue}" id="theHiddenInput"/>


This tag supports following attributes: 
Attribute
Description
id
An identifier that allows the inputHidden component to be referenced by other components in the page.
immediate
A Boolean value that specifies whether the action associated with this component should happen immediately, without processing any validation rules associated with the fields on the page. If set to true, the action happens immediately and validation rules are skipped. If not specified, this value defaults to false.
rendered
A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true.
required
A Boolean value that specifies whether this inputHidden field is a required field. If set to true, the a value must be specified for this field. If not selected, this value defaults to false.
value
A merge field that references the controller class variable that is associated with this hidden input field. For example, if the name of the associated variable in the controller class is myHiddenVariable, use value="{!myHiddenVariable}" to reference the variable.


Visualforce Example :

<apex:page standardController="Account">
    <apex:form >
        <apex:pageBlock title="My Content" mode="edit">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="My Content Section" columns="2">
                <apex:inputField value="{!account.name}"/>
                <apex:inputField value="{!account.type}"/>
               <apex:inputhidden value="{!account.accountNumber}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>


save image





4 comments:

Unknown said...

• Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updating. Power Bi Online Training BANGALORE

huks said...

So, what value will pass in Account # field? Can we default that value to something like 12345?

huks said...

Can't see the Comments? It just says 2 comments: Can you please make Comments visible? Thanks!

Anonymous said...

i used similar " " but getting error in security review : "inputText Ignoring FLS"

Post a Comment

 
| ,