Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am embedding a VisualForce page with a form and some inputs in a standard page layout. My form mark-up:

<apex:page standardController="Contact" extensions="ContactControllerExt" action="{!init}" showHeader="false" sidebar="false" doctype="html-5.0">
    <apex:pagemessages />

    <apex:outputpanel rendered="{!showAssignPanelB}">
        <apex:form >
            <apex:selectList id="area" size="1" label="Area">
                <apex:selectOptions value="{!regionSelectList}" />
            <apex:commandButton value="Assign" action="{!assignContact}"/><br/>
            <input type="text" name="reason" placeholder="Reason" />
        <apex:commandButton value="Not Approved" action="{!mediaBNotApprove}"/><br/>

If I replace the text input field with:

<apex:inputText id="reason"/>

the element renders as:

<input type="text" name="j_id0:j_id28:reason" id="j_id0:j_id28:reason" />

and I don't know how to look for that name in the page parameters in the controller. The <select ...> element also renders with an unpredictable name like j_id0:j_id28:area

How can I get the rendered names more predictable?

share|improve this question
up vote 4 down vote accepted

Short answer

Use the value attribute of the select list to bind your select list to a controller property, it'll then be accessible to apex code, without needing to look for it in the page parameters.

<apex:selectList value="{!yourControllerVar}" ...

Suggested Reading

Data binding is a fundamental feature of Visualforce and is very helpful to understand. You can read more about it in the Visualforce API Docs (search for "input") which sadly doesn't do a great job on the subject, but will hopefully get you going.

share|improve this answer
Hey! Waaay easier than picking around for form data in HTML headers. Thanks Ralph! – JannieT Jan 22 '14 at 6:29

The rendered names are going to show up like that when it converts the VF tags to HTML. You have a couple options:

Additionally, your use case might not necessarily require you to know the ID at run time. Is this something you could handle with data binding (as mentioned in @Ralph's answer)?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.