You need to sign in to do that
Don't have an account?

How to set this visualforce page as my action NEW page instead of the standard page
hello,
my visualforce
my apex
I go to the custome object --> Buttons, Links, and Actions --> edit NEW -->Override With: (but doesn't show my visual)
Visualforce Page --None--
it should be Visualforce Page --ContadorAnteriorRapido--
I know is because of the controller, but if I put the standardController="Contador_Anterior__c" I can't work with my apex.
and I try standardController="Contador_Anterior" extension="ContadorAnteriorRapidoController" but I get an error of "Unknown constructor 'ContadorAnteriorRapidoController.ContadorAnteriorRapidoController(ApexPages.StandardController controller)"
can someone help please,
thanks
my visualforce
<apex:page controller="ContadorAnteriorRapidoController" tabStyle="Contador_Anterior__c"> <script> function confirmCancel() { var isCancel = confirm("Estas seguro que desea cancelar la creación de los Contadores?"); if (isCancel) return true; return false; } </script> <apex:sectionHeader title="Creación de" subtitle="Contadores"/> <apex:form > <div style="font-size: 12px; color:#FF0000; "> <apex:pageMessages id="errMessages" escape="false" /> </div> <apex:pageBlock mode="edit" > <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Guardar"/> <apex:commandButton action="{!cancelar}" value="Cancelar" onclick="return confirmCancel()" immediate="true"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Maquina" columns="1"> <apex:inputField value="{!Contador.Fecha__c}"/> <apex:inputField value="{!contador.Sucursal__c}"/> <apex:inputField value="{!contador.Maquina__c}"/> <apex:inputField value="{!contador.Tipo_de_Contador__c}"/><br/> <apex:inputField value="{!Contador.Contador_Anterior_m__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
my apex
public class ContadorAnteriorRapidoController { public Contador_Anterior__c contador; public Contador_Anterior__c getContador(){ if(contador==null)contador=new Contador_Anterior__c(); //VM if(contador.Sucursal__c=='Maker Villa Morra'){ contador.Maquina__c='Xerox700 (s979)'; contador.Tipo_de_Contador__c='BnC'; } return contador; } //Boton Cancelar ContadorRapido public PageReference cancelar(){ PageReference pr=new PageReference(''); pr.setRedirect(true); return pr; } //Boton Guardar ContadorRapido public PageReference save(){ try{ If(contador.Sucursal__c!='Maker Villa Morra' && contador!=null){ insert contador; } } catch(exception ex) { ApexPages.addMessages(ex); return null; } PageReference ContadorAnteriorRapido = new ApexPages.StandardController(contador).view(); ContadorAnteriorRapido.setRedirect(true); return ContadorAnteriorRapido; } }
I go to the custome object --> Buttons, Links, and Actions --> edit NEW -->Override With: (but doesn't show my visual)
Visualforce Page --None--
it should be Visualforce Page --ContadorAnteriorRapido--
I know is because of the controller, but if I put the standardController="Contador_Anterior__c" I can't work with my apex.
and I try standardController="Contador_Anterior" extension="ContadorAnteriorRapidoController" but I get an error of "Unknown constructor 'ContadorAnteriorRapidoController.ContadorAnteriorRapidoController(ApexPages.StandardController controller)"
can someone help please,
thanks
Try this!
<apex:page showHeader="false" standardController="CustomObjectName" extensions="ContadorAnteriorRapidoController" >