1

I have the following piece of code in a component

<apex:attribute name="Model" description="" type="PAModel" required="true" />

<div>
<input type="button" style="display: block; float: left;" value="Upload" action="{!Model.saveAllRelated}" />
</div>

In the PAModel class I am having the following method

public void saveAllRelated(){
}

But Everytime I try to save the component, it is giving me Error: Unknown property 'PAModel .saveAllRelated'
Please tell me what is the problem with this code.

2
  • Did you try saving it from salesforce visual force component window? Because when I try saving from developer console, I am getting error. But when I try from salesforce visual force component it is saving without error. Apr 8, 2016 at 10:42
  • Model is your parent VF page controller ?
    – Ratan Paul
    Apr 8, 2016 at 12:16

1 Answer 1

0

You are using a raw HTML input element and in that context Visualforce interprets this:

action="{!Model.saveAllRelated}"

as a reference to some text to output for a HTML action attribute i.e. a property getter is needed for the page to compile.

What it looks like you are aiming for is this (which will allow the page to compile):

<apex:commandButton
        style="display: block; float: left;"
        value="Upload"
        action="{!Model.saveAllRelated}"
        />

where the action attribute is a method name (that optionally returns a PageReference) that is automatically wired up to the button click in the HTML/JavaScript that the Visualforce tag emits.

You must log in to answer this question.

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