You need to sign in to do that
Don't have an account?
Chanagan Sakulteera
what is error answer to me please.
This is error
Formula Expression is required on the action attributes.
Formula Expression is required on the action attributes.
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
<apex:commandbutton value="Submit" action="SubmitAc">
but you should be give like below
<apex:commandbutton value="Submit" action="{!SubmitAc}">
Hope it helps!
<apex:commandButton value="Save" action="{!onSave}"/>
This is full code VF Page.
<apex:page standardController="Product_Service__c" extensions="CostCalculationExtention">
<script language="javascript">
function IsNumeric(sText,obj){
var ValidChars = "0123456789.";
var IsNumber=true;
var Char;
for (i = 0; i < sText.length && IsNumber == true; i++){
Char = sText.charAt(i);
if (ValidChars.indexOf(Char) == -1){
IsNumber = false;
}
}
if(IsNumber==false){
alert("Input number only!!");
obj.value=sText.substr(0,sText.length-1);
}
}
</script>
<apex:sectionHeader Title="Cost Calculation" subtitle="{!theProduct.Name}"/>
<apex:form >
<apex:pageBlock title="Cost Calculation">
<apex:pageblockTable value="{!lstProductService}" var="lstPS">
<apex:column headerValue="Service">
<apex:outputField value="{!lstPS.Service__r.Name}"/>
</apex:column>
<apex:column headerValue="Client Exp - Adult">
<apex:inputField id="clientAdult" value="{!lstPS.Client_Expense_Adult__c}" onkeypress="IsNumeric(this.value,this)"/>
</apex:column>
<apex:column headerValue="Client Exp - Child">
<apex:inputField id="clientChild" value="{!lstPS.Client_Expense_Child__c}" onkeypress="IsNumeric(this.value,this)"/>
</apex:column>
<apex:column headerValue="T/L Exp">
<apex:inputField id="tlExp" value="{!lstPS.Tour_Leader_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
</apex:column>
<apex:column headerValue="L/G Exp">
<apex:inputField id="lgExp" value="{!lstPS.Local_Guide_Expense__c}" onkeypress="IsNumeric(this.value,this)"/>
</apex:column>
<apex:column headerValue="Coach">
<apex:inputField id="coach" value="{!lstPS.Coach__c}" onkeypress="IsNumeric(this.value,this)"/>
</apex:column>
</apex:pageblockTable>
<br/>
<center><apex:commandButton value="Save" action="{!onSave}"/></center>
</apex:pageBlock>
</apex:form>
</apex:page>
And this is full code controller.
public with sharing class CostCalculationExtention{
//-- Open Page --\\
public Product__c theProduct {get; set;}
private String productId {get; set;}
public Product_Service__c[] lstProductService {get; set;}
//-- Open Page --\\
//-- Attribute --\\
public Double sum {get; set;}
//-- Attribute --\\
//-- Constructor --\\
public CostCalculationExtention(ApexPages.StandardController controller) {
productId = apexpages.currentpage().getparameters().get('CF00NO0000001EtuG_lkid');
//system.debug('ProductId : ' + productId);
theProduct = [select id, name from Product__c where id =: productId];
//system.debug('The Product : ' + theProduct);
lstProductService = [select id, name, Service__r.Name, Service__r.Id, Client_Expense_Adult__c, Client_Expense_Child__c, Tour_Leader_Expense__c, Local_Guide_Expense__c, Coach__c from Product_Service__c where Product__r.id =: theProduct.Id];
//system.debug('List Product_Service : ' + lstProductService);
}
//-- Constructor --\\
//-- Save --\\
public PageReference onSave(){
upsert(lstProductService);
//return new PageReference('/' + ApexPages.currentPage().getParameters().get('CF00NO0000001EtuG_lkid='+theProduct.Id+'&CF00NO0000001EtuG='+theProduct.Name));
String url = 'apex/Cost_Calculator_2?&CF00NO0000001EtuG_lkid='+theProduct.Id+'&CF00NO0000001EtuG='+theProduct.Name;
system.debug('URL : ' + url);
PageReference pref=new PageReference(url);
return pref;
}
//-- Save --\\
}