• newbiemba
  • NEWBIE
  • 15 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 8
    Replies

Hello All,

This issue is really bugging me.
I have a visualforce page which is enabled in the force.com site and I have changed the permission set for guest profile to create,edit etc my custom obejct but still I am not seeing the controller class being run from visualforce page.

 

My visualforce page is
<apex:page sidebar="false" showHeader="true" standardStylesheets="false" standardController="Main_questionaire__c" extensions="QuestionnaireFieldsSite" recordSetVar="sitem" id="thePages" >

<apex:form id="templateForm">
<br></br>
<apex:actionFunction name="sectionStatusJS" action="{!sectionStatus}" reRender="buttonPanel"/>

<p style="text-align:center;font-size:18px">Assessment</p>
<apex:outputPanel id="buttonPanel">


<script>
window.onload=function()
{
sectionStatusJS();
setmyFlag(true);
};
</script>
</apex:outputPanel>

<apex:outputPanel rendered="{!myFlag}">
<apex:pageBlock >
<apex:pageBlockSection id="sectionBlock" title="Sections" columns="4">
<apex:repeat value="{!sectionsStatusLists}" var="section">
<apex:commandButton value=" {!section.Section_Template__r.Section_label__c}" style="text-align:center;">
<apex:param name="sectionId" value="{!section.Section_Template__r.id}"/>
<apex:param name="doRerender" value="true" assignTo="{!doRerender}"/>
</apex:commandButton>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>

</apex:form>
</apex:page>


Apex class THIS CLASS'S IS NEVER CALLED.I SAW THE DEBUG IT DOESNT GET CALLED AT ALL ,NOT EVEN THE CONSTRUCTORS DEBUG STATEMENT

public with sharing class QuestionnaireFieldsSite
{

public List<Section_Template__c > sectionsLists{ get; set; }
public List<Main_questionaire__c> templateLists { get; set; }
public List<SectionStatus__c > sectionsStatusLists{ get; set; }

static integer ltoggle=0;
public Transient Boolean doRerender;
public Boolean getdoRerender(){return doRerender;}

public Boolean myFlag{get; set;}
public void setmyFlag(Boolean flags)
{this.myFlag=flags;}

public void setdoRerender(Boolean doRerender)
{
this.doRerender = doRerender;
System.debug('doRerender should be set here to true: doRerender = '+this.doRerender);
}

public QuestionnaireFieldsSite(ApexPages.StandardSetController controller) {
refreshPagePart=false; System.debug('----------initialized in sectionstatus'+myFlag);
}
public QuestionnaireFieldsSite(){System.debug('-2---------initialized in sectionstatus'+myFlag);}

public void
{myFlag=false;
theToggleVal =false;System.debug('----------initialized in sectionstatus'+myFlag);
if (!myFlag)
{
SectionStatus__c[] StatusLists=new SectionStatus__c[]{};
accountId=System.currentPageReference().getParameters().get('accId');

templateLists = [Select Id, Name from Main_questionaire__c limit 1];
if(templateLists!=NULL && templateLists.size()>=1)
{
templateName = templateLists.get(0).Name;
sectionsLists = [Select Id, Name,status__c,Section_label__c,Order_No__c from Section_Template__c where Questionnaire_Section__c=:templateLists.get(0).Id order by Order_No__c];
SectionStatus__c[] userSectionStatus=[Select id,Section_Template__c,Status__c,User__c,Account_to_SectionStatus__c from SectionStatus__c where Account_to_SectionStatus__c= :accountId] ;
if((userSectionStatus==null)||(userSectionStatus.size()==0))
{
System.debug('~~~~~~~~~~~~~COMES IN SECTION STATUS');
for(Section_Template__c res: sectionsLists )
{

SectionStatus__c stat=new SectionStatus__c();
stat.User__c=UserInfo.getUserId();

System.debug('~~~~~~~~~~~~~default controller------'+stat);
StatusLists.add(stat);

}
try
{
upsert StatusLists;
}
catch(DmlException e){System.debug('~~~~~~~~~~~~~EXCEPTION --'+e);}
}

}

}
sectionsStatusLists=[Select id,Section_Template__c,Section_Template__r.id,Section_Template__r.Section_Label__c from SectionStatus__c where Section_Template__c!=null ] ;

} myFlag=true;}
}

 

Please help.

Hello,

 

I have a custom object with a lookup field to another custom object. Now using one for in visualforce i want to save data to both of these objects.My issue is I cant retrieve any calue of the lookup object fields in my controller class or even save from my vf page.

 

Code is below

vf page

<apex:page standardController="Incident_Report__c" tabstyle="account" standardStylesheets="false" sidebar="false" extensions="IncidentReportController" >

<style type="text/css">
.inputTextBig { width: 80%; }
.inputTextWidthMedium { width: 25%; }
.inputTextWidthMediumSchool { width: 20%; }
</style>

<apex:form id="incidentForm">
<br></br>
<TABLE>

<TR >
<TD colspan="2"><apex:inputField value="{!DoDEA_Serious_Incident_Report__c.Other_Incidents__c}"></apex:inputField></TD>
</TR>
<TR>
<td>

<!-- this is the lookup field data which I want to save in database ot at least access in apex controller so that I can save it there-->
<TABLE cols="5" align="LEFT" WIDTH="100%">
<TR style="font-style:bold;">
<TD>PARTICIPANTS(List name as last, first,MI) </TD><TD>GENDER </TD><TD>AGE </TD><TD>GRADE </TD><TD>STATUS </TD>
</TR>
<TR>
<TD><apex:inputField value="{!Incident_Report__c.Incident_Report_Participants__r.Last_Name__c}"></apex:inputField><apex:inputField value="{!Incident_Report__c.Incident_Report_Participants__r.First_Name__c}" ></apex:inputField><apex:inputField value="{!Incident_Report__c.Incident_Report_Participants__r.MI_Name__c}" ></apex:inputField> </TD></TD>
</TR>
</TABLE>
</td>
</TR>
<apex:commandButton value="Save" action="{!Save}"/>

</TABLE>

</apex:form>

</apex:page>

 

Controller

public with sharing class IncidentReportController {
public PageReference refresh= new PageReference(ApexPages.currentPage().getUrl());
public Incident_Report__c VisRecord;
public Incident_Report_Participants__c Participants;
public IncidentReportController(ApexPages.StandardController controller)
{
System.debug('eeee~~~~~~~~~~~~~------'+controller.getRecord());
VisRecord=(Incident_Report__c)controller.getRecord();
VisRecord.Date_and_Time__c= System.now();//Date.today();

}

public PageReference save()
{
System.debug('~THIS IS NULL~~~~~~~~~~~~------'+VisRecord.Incident_Report_Participants__r.Last_Name__c);
//upsert visRecord;
PageReference cancelClicked=new PageReference('/home/home.jsp');
cancelClicked.setRedirect(false);
return cancelClicked;


}

 

 

Thanks

Hello,

 

I was wondering if we there is a feature to change the Photo on Contacts, I went on customize or edit layout etc but I couldnt find it anywhere.I read that that before it couldnt be done but I dont know if we have a work around or something to chnage the photo.

 

Thanks

Arp

Hello All,

This issue is really bugging me.
I have a visualforce page which is enabled in the force.com site and I have changed the permission set for guest profile to create,edit etc my custom obejct but still I am not seeing the controller class being run from visualforce page.

 

My visualforce page is
<apex:page sidebar="false" showHeader="true" standardStylesheets="false" standardController="Main_questionaire__c" extensions="QuestionnaireFieldsSite" recordSetVar="sitem" id="thePages" >

<apex:form id="templateForm">
<br></br>
<apex:actionFunction name="sectionStatusJS" action="{!sectionStatus}" reRender="buttonPanel"/>

<p style="text-align:center;font-size:18px">Assessment</p>
<apex:outputPanel id="buttonPanel">


<script>
window.onload=function()
{
sectionStatusJS();
setmyFlag(true);
};
</script>
</apex:outputPanel>

<apex:outputPanel rendered="{!myFlag}">
<apex:pageBlock >
<apex:pageBlockSection id="sectionBlock" title="Sections" columns="4">
<apex:repeat value="{!sectionsStatusLists}" var="section">
<apex:commandButton value=" {!section.Section_Template__r.Section_label__c}" style="text-align:center;">
<apex:param name="sectionId" value="{!section.Section_Template__r.id}"/>
<apex:param name="doRerender" value="true" assignTo="{!doRerender}"/>
</apex:commandButton>
</apex:repeat>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:outputPanel>

</apex:form>
</apex:page>


Apex class THIS CLASS'S IS NEVER CALLED.I SAW THE DEBUG IT DOESNT GET CALLED AT ALL ,NOT EVEN THE CONSTRUCTORS DEBUG STATEMENT

public with sharing class QuestionnaireFieldsSite
{

public List<Section_Template__c > sectionsLists{ get; set; }
public List<Main_questionaire__c> templateLists { get; set; }
public List<SectionStatus__c > sectionsStatusLists{ get; set; }

static integer ltoggle=0;
public Transient Boolean doRerender;
public Boolean getdoRerender(){return doRerender;}

public Boolean myFlag{get; set;}
public void setmyFlag(Boolean flags)
{this.myFlag=flags;}

public void setdoRerender(Boolean doRerender)
{
this.doRerender = doRerender;
System.debug('doRerender should be set here to true: doRerender = '+this.doRerender);
}

public QuestionnaireFieldsSite(ApexPages.StandardSetController controller) {
refreshPagePart=false; System.debug('----------initialized in sectionstatus'+myFlag);
}
public QuestionnaireFieldsSite(){System.debug('-2---------initialized in sectionstatus'+myFlag);}

public void
{myFlag=false;
theToggleVal =false;System.debug('----------initialized in sectionstatus'+myFlag);
if (!myFlag)
{
SectionStatus__c[] StatusLists=new SectionStatus__c[]{};
accountId=System.currentPageReference().getParameters().get('accId');

templateLists = [Select Id, Name from Main_questionaire__c limit 1];
if(templateLists!=NULL && templateLists.size()>=1)
{
templateName = templateLists.get(0).Name;
sectionsLists = [Select Id, Name,status__c,Section_label__c,Order_No__c from Section_Template__c where Questionnaire_Section__c=:templateLists.get(0).Id order by Order_No__c];
SectionStatus__c[] userSectionStatus=[Select id,Section_Template__c,Status__c,User__c,Account_to_SectionStatus__c from SectionStatus__c where Account_to_SectionStatus__c= :accountId] ;
if((userSectionStatus==null)||(userSectionStatus.size()==0))
{
System.debug('~~~~~~~~~~~~~COMES IN SECTION STATUS');
for(Section_Template__c res: sectionsLists )
{

SectionStatus__c stat=new SectionStatus__c();
stat.User__c=UserInfo.getUserId();

System.debug('~~~~~~~~~~~~~default controller------'+stat);
StatusLists.add(stat);

}
try
{
upsert StatusLists;
}
catch(DmlException e){System.debug('~~~~~~~~~~~~~EXCEPTION --'+e);}
}

}

}
sectionsStatusLists=[Select id,Section_Template__c,Section_Template__r.id,Section_Template__r.Section_Label__c from SectionStatus__c where Section_Template__c!=null ] ;

} myFlag=true;}
}

 

Please help.

Hello,

 

I was wondering if we there is a feature to change the Photo on Contacts, I went on customize or edit layout etc but I couldnt find it anywhere.I read that that before it couldnt be done but I dont know if we have a work around or something to chnage the photo.

 

Thanks

Arp

Hello,

 

I have a 2 lists which i want to display alternatively.

My code is 

 

<apex:repeat value="{!questionsList}" var="section">
<apex:variable var="rlists" value="{!section.rlistss}"/>
<apex:variable var="i" value="{!0}"/>
<apex:repeat value="{!section.qlistss}" var="qlist">
<apex:outputField value="{!qlist.Question_Label__c}" />
<apex:outputField value="{!rlists[i].Response__c}" /> <!--This doesnt workhow to iterate this also after each question display 1 response-->
<br> </br>

</apex:repeat>

 

 

Thanks

  • January 29, 2013
  • Like
  • 0

hello,

 

I have tables for sections,questions and response with master detail relationship between sction and question, question and response table. I want to display all of them with response under question and all questions under section.

 

Apex code 

public class QuestionnaireFieldsReport
{

public List<Question_Template__c> questionsLists { get; set; }
public List<Section_Template__c > sectionsLists{ get; set; }
public List<Questionnaire_Response__c> QuestionResponse{get;set;}
public List<QuestionDisplay> listQuestWithOptions;

 

//create a new inner class 
public class QuestionDisplay
{

public Question_Template__c newquestFormat{get;set;}
public List<Question_Template__c > qlistss {get;set;}
public List<Questionnaire_Response__c> rlistss{get;set;}
public Section_Template__c secObj{get;set;}



public QuestionDisplay(Section_Template__c sobj,List<Question_Template__c > ql,List<Questionnaire_Response__c> rl)
{
secObj= new Section_Template__c ();
qlistss =new List<Question_Template__c>();
rlistss= new List<Questionnaire_Response__c>();
this.secObj=sobj;
this.qlistss =ql;
this.rlistss=rl;
}
}//end inner class


public List<QuestionDisplay> getquestionsList()
{
Integer i=0;
listQuestWithOptions= new QuestionDisplay[]{};
accountId=System.currentPageReference().getParameters().get('accId');//to get the school or account id
//System.debug('!!!!!!!!!!!!!!!!~~~~~~~~~~~~~acct id from diff page :'+accountid);
sectionsLists = [Select Id, Name,status__c,Section_label__c,Order_No__c from Section_Template__c];
QuestionResponse=[Select id,Response__c,Question_Template__r.id,Question_Template__r.Question_Label__c,Account_to_Response__c,Questionnaire_Taker_user__c from Questionnaire_Response__c where Account_to_Response__c= :accountId] ;


for(integer w=0;w<sectionsLists.size();w++)
{
List<Question_Template__c > qlists= new List<Question_Template__c>();
List<Questionnaire_Response__c> rlists= new List<Questionnaire_Response__c>();
questionsLists = [SELECT Id,Section_Question__r.id,Question_Label__c,Question_Order_No__c FROM Question_Template__c where Section_Question__r.id=:sectionsLists[w].id order by Question_Order_No__c];

for(integer w1=0;w1<questionsLists.size();w1++)
{
Questionnaire_Response__c resp=new Questionnaire_Response__c();
if((QuestionResponse==null)||(QuestionResponse.size()==0))
{

rlists.add(resp);
qlists.add(questionsLists[w1]);
}
else
{
integer checkflag=0;
for(integer k=0;k<QuestionResponse.size();k++)
{
if(QuestionResponse[k].Question_Template__r.id==questionsLists[w1].id)
{
checkflag=1;resp=QuestionResponse[k];break;
}
}

rlists.add(resp);
qlists.add(questionsLists[w1]);
}

}

//r is reponse list and qlists is question list
listQuestWithOptions.add(new QuestionDisplay(sectionsLists[w],qlists,rlists) );

}


}

 

Visualforce code

I want the response and questions list to iterate alternatively

 

<apex:repeat value="{!questionsList}" var="section">
<apex:variable var="rlists" value="{!section.rlistss}"/>
<apex:pageBlockSection id="subsection" columns="1" title="{!section.secObj.Section_label__c}">
<apex:repeat value="{!section.qlistss}" var="qlist">
<apex:outputField value="{!qlist.Question_Label__c}" />
<apex:outputField value="{!rlists.Response__c}" /> <!-- this fails as i do not know how to iterate both together-->
<br> </br>

</apex:repeat>

 

 

Thanks

  • January 29, 2013
  • Like
  • 0