anusha(salesforce developer)

Friday, 29 July 2016

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


No comments:

Post a Comment