0

I'm not sure if apex:form is supposed to show up as something on the HTML, but I don't see it and document.getElementById() is not finding it. This is what I have:

<apex:page id="parampage">
    <apex:form id="paramform">
      <apex:param name="param" id="param" value="123"/>
    </apex:form> 
<apex:page>

These are the results when I do a JS call:

  1. alert('{!$Component.parampage.paramform}') result: parampage:paramform (as expected)

  2. alert('{!$Component.parampage.paramform.param}') result: parampage:paramform:param (as expected)

  3. document.getElementById('{!$Component.parampage.paramform}') result: returns the expected object

  4. document.getElementById('{!$Component.parampage.paramform.param}') result: null

1

apex:param is a logical construct that represents a parameter to some "managed" element (e.g. an element that uses the apex namespace). Technically, your code shouldn't compile, as the documentation for this element states:

A parameter for the parent component.
The <apex:param> component can only be a child of the following components:
<apex:actionFunction>
<apex:actionSupport>
<apex:commandLink>
<apex:outputLink>
<apex:outputText>
<flow:interview>

Regardless, it doesn't generate any sort of element that you can simply grab by HTML ID. Instead, it's used to define the parameters that will be placed into a given function call back on the server.

For example, within an apex:actionFunction, it defines values that can be passed by JavaScript, and those parameters will be passed to the controller.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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