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?

2 Answers 2


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.

  • Hey! Waaay easier than picking around for form data in HTML headers. Thanks Ralph!
    – JannieT
    Jan 22, 2014 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)?

You must log in to answer this question.

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