You need to sign in to do that
Don't have an account?
Martin Chalot 15
Site Guest User - Action always redirect on authorization page
Hi,
I create a site for guest user. The site can display different stuff depending on the URL i'm reading. Depending on the URL I display one or another component.
For the first component there is no problem, I click save the action occurs and it some variable are changing and it display either an error or success message (same page)
But on my other component when I click on the action button it always get redirected on the unauthorization page... The action does absolutely nothing, it's a void function with no code inside. Can you tell me what's wrong with the following controller :
And the component, is here :
Can you help me ?
Here the visualforce page that display the compoenent if needed :
Thanks,
Regards,
Martin
I create a site for guest user. The site can display different stuff depending on the URL i'm reading. Depending on the URL I display one or another component.
For the first component there is no problem, I click save the action occurs and it some variable are changing and it display either an error or success message (same page)
But on my other component when I click on the action button it always get redirected on the unauthorization page... The action does absolutely nothing, it's a void function with no code inside. Can you tell me what's wrong with the following controller :
public class surveyController { public Id oppId {get;set;} public Id surId {get;set;} public Id accId {get;set;} public Id conId {get;set;} public Id prestaId {get;set;} public boolean success {get;set;} public boolean failure {get;set;} public Survey__c survey {get;set;} public String test {get;set;} public surveyController() { this.success = false; this.failure = false; this.oppId = ApexPages.currentPage().getParameters().get('o'); this.surId = ApexPages.currentPage().getParameters().get('s'); this.accId = ApexPages.currentPage().getParameters().get('a'); this.conId = ApexPages.currentPage().getParameters().get('c'); this.prestaId = ApexPages.currentPage().getParameters().get('ps'); if(this.oppId != null && this.surId != null && this.accId != null) { this.survey = [SELECT Id, Name, active__c,Affaire__c,Client__c,Moyenne__c, Prestataire__c,Prestataire_Selectionne__c,Sum_Coef__c,Sum_Reponse__c, (SELECT Id, Libelle__c, Possible_answers__c, RecordType.Name, Reponse__c, ValueReponse__c,RealValue__c,Order__c,Survey__c, Notable__c,Coef__c FROM Questions__r ORDER BY Order__c ASC) FROM Survey__c WHERE active__c = true AND RecordType.Name = 'Template' AND Id = :this.surId]; System.debug(this.survey.Questions__r); } } public List<SelectOption> getRadioOption() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('1','1')); options.add(new SelectOption('2','2')); options.add(new SelectOption('3','3')); options.add(new SelectOption('4','4')); options.add(new SelectOption('5','5')); return options; } public List<SelectOption> getPicklistOption() { List<SelectOption> options = new List<SelectOption>(); options.add(new SelectOption('1','Insatisfaisant')); options.add(new SelectOption('2','Peu satisfaisant')); options.add(new SelectOption('3','Neutre')); options.add(new SelectOption('4','Bien')); options.add(new SelectOption('5','Incroyable')); return options; } public void savePerso() { } }
And the component, is here :
<apex:component controller="surveyController" allowDML="true"> <apex:attribute name="opportunityId" assignTo="{!oppId}" type="Id" description="Opportunity" required="true"/> <apex:attribute name="prestaSelectionne" assignTo="{!prestaId}" type="Id" description="Id Objet de jonction" required="true"/> <apex:attribute name="contactId" assignTo="{!conId}" type="Id" description="Contact" required="true"/> <apex:attribute name="accountId" assignTo="{!accId}" type="Id" description="Account prestataire" required="true"/> <apex:attribute name="surveyId" assignTo="{!surId}" type="Id" description="Survey" required="true"/> <apex:outputPanel rendered="{!success}"> Bravo les informations ont été modifiées </apex:outputPanel> <apex:outputPanel rendered="{!failure}"> Une erreur est survenue </apex:outputPanel> <apex:outputPanel rendered="{!success == false && failure == false && survey!=null}"> <h1>Survey Name : {!survey.Name}</h1> <apex:form > <apex:repeat value="{!survey.Questions__r}" var="q"> <h2>{!q.Libelle__c}</h2> <apex:outputPanel rendered="{!q.RecordType.Name == 'Checkbox'}"> <apex:selectRadio value="{!q.Reponse__c}"> <apex:selectOptions value="{!radioOption}"/> </apex:selectRadio> </apex:outputPanel> <apex:outputPanel rendered="{!q.RecordType.Name == 'Texte Libre'}"> <apex:inputTextarea value="{!q.Reponse__c}"/> </apex:outputPanel> <apex:outputPanel rendered="{!q.RecordType.Name == 'Picklist'}"> <apex:selectList value="{!q.Reponse__c}" multiselect="false"> <apex:selectOptions value="{!picklistOption}"/> </apex:selectList> </apex:outputPanel> <br/> </apex:repeat> <br/><br/> <apex:commandButton action="savePerso" value="Envoyer le questionnaire"/> </apex:form> </apex:outputPanel> </apex:component>
Can you help me ?
Here the visualforce page that display the compoenent if needed :
<apex:page controller="siteController" showChat="false" showHeader="false" showQuickActionVfHeader="false" sidebar="false" standardStylesheets="{!standardStylesheet}"> <c:AccountComponent myaccountId="{!accountId}" rendered="{!callIsCorrect && pageCalled == 'account'}"/> <apex:outputPanel rendered="{!callIsCorrect && pageCalled == 'survey'}"> <c:surveyComponent opportunityId="{!opportunityId}" accountId="{!accountId}" surveyId="{!surveyId}" contactId="{!clientId}" prestaSelectionne="{!prestaId}"/> </apex:outputPanel> <apex:outputPanel rendered="{!callIsCorrect == false}"> Votre URL n'est pas correcte. </apex:outputPanel> </apex:page> public class siteController { public boolean callIsCorrect {get;set;} public String pageCalled {get;set;} public boolean standardStylesheet {get;set;} /* * Parameter for survey */ public Id opportunityId {get;set;} public Id accountId {get;set;} public Id surveyId {get;set;} public Id clientId {get;set;} public Id prestaId {get;set;} /* * Parameter for account * public Id accountId {get;set;}*/ public siteController() { this.callIsCorrect = false; this.standardStylesheet = false; this.pageCalled = ApexPages.currentPage().getParameters().get('p'); if(this.pageCalled == 'account') { this.standardStylesheet = true; this.accountId = ApexPages.currentPage().getParameters().get('a'); if(this.accountId != null) { this.callIsCorrect = true; } } else if(this.pageCalled == 'survey') { this.opportunityId = ApexPages.currentPage().getParameters().get('o'); this.surveyId = ApexPages.currentPage().getParameters().get('s'); this.accountId = ApexPages.currentPage().getParameters().get('a'); this.clientId = ApexPages.currentPage().getParameters().get('c'); this.prestaId = ApexPages.currentPage().getParameters().get('ps'); if(this.opportunityId != null && this.surveyId != null && this.accountId != null && this.prestaId != null && this.clientId != null) { this.callIsCorrect = true; } } } }
Thanks,
Regards,
Martin
I found it because I end up trying the visualforce directly on the visualforce (not the guest website) and it displays me the message :
formula Expression is required on the action attributes.
I advised you to do the same if you can't find out what's wrong, at least you'll have a real debugger