You need to sign in to do that
Don't have an account?
help with actionFunction and object validation
Hi,
I'm having a problem using the actionFunction
My page have a buttom [Add New Car] that creates a empty Custom Object and show a form to allow the user to define the object properties
PAGE
<apex:form >
<apex:actionFunction name="Add_Car" action="{!showAdd_Car}" rerender="Container_Car" status="myStatus" />
<apex:actionFunction name="CancelAction" action="{!cancelActionr}" rerender="Container_Car" status="myStatus" />
.....
<a class="btn" onclick="Add_Car();" href="#">Add a new Car</a>
......
<apex:outputPanel id="Container_Car" rendered="{!IF(showForm=='showAdd_Car', 'true', 'false')}">
<h3>New Car</h3>
<apex:inputField value="{!currentCar.Name}" />
......
<a class="btn" href="#" onclick="SaveObject();">Save Changes</a>
<a class="btn" href="#" onclick="CancelAction();">Cancel</a>
</apex:outputPanel>
</apex:form>
CONTROLLER
public PageReference showAdd_ShipToAddress() {
currentCar = new Car__c();
showForm = 'showAdd_Car';
return null;
}
public PageReference cancelAction () {
currentCar = new Car__c();
return null;
}
______________________________________________________________________
The first part, show the form, works great.
My problem is the cancel action.
When I click on the cancel button, the server side is called, but before my action cancelAction be called, the currentCar object is validated and return some message errors because the inputFields for the validade properties are empty.
Is it possible to disable the object validation before I submit?
Or how do I intercept the call before the object is validade in the controller?
thanks a lot
Try
Regards
All Answers
Try
Regards
thanks a lot!