in below documentation Apex page templates

There is a template,say formTemplate

<apex:page controller="templateExample">
        <apex:outputLabel value="Enter your name: " for="nameField"/>
        <apex:inputText id="nameField" value="{!nameField}"/>
        <apex:commandButton action="{!save}" value="Save" id="saveButton"/>

which is included in another page say PageA

<apex:page controller="templateExample">
    <apex:include pageName="formTemplate"/>
    <apex:actionSupport event="onClick" 
    <apex:outputText id="greeting" rendered="{!showGreeting}" value="Hello {!nameField}"/>

in page A..there is an action support which looks like not bound to any element but when this page is executed and save button is clicked(Save button which was present in template) this action support event gets invoked?

I always thought action support should be tied to some component. is that not necessary?

1 Answer 1


I've done some experiments with a very basic page, and it doesn't get bound to anything. In the generated source code I see this:

<script> function j_id1_onClick(){</script>

which is clearly invalid and is flagged as such by the Firefox developer tools:

SyntaxError: missing } after function body

Also, there is no element in the page with the id j_id1. Interestingly enough, it doesn't generate any errors when you use this without <apex:form> tags like some other VF tags do, but once you put the form tags in then it does at least generate correct Javascript.

I'll do some more experimentation when I get the chance, it could be that it gets bound to the preceeding form control: in this case the command button in the included page. To me it seems like there's a chance it's simply doing nothing in the example in the docs, since the command button in the included page does not have a rerender attribute specified, resulting in the behavior the author was expecting (i.e. the panel gets rerendered because everything is).

You must log in to answer this question.

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