• JimmyBeWhite
  • NEWBIE
  • 50 Points
  • Member since 2011

  • Chatter
    Feed
  • 2
    Best Answers
  • 7
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies

I've run into an issue that is baffling and frustrating. I've got a pageblocktable that simply shows a few elements of a wrapper class that includes some selectoptions, display strings, and most importantly a boolean that is tied to a checkbox. I just discovered that the checkbox values are not binding to the booleans in the wrapper (they were last week), which totally breaks the page and sucks. Please help me...

 

here's the visualforce code: 

<apex:pageBlockTable title="Select School(s)" var="s" value="{!schoolListChoices}">
     <apex:column title="Select">     
          <apex:facet name="header">Select</apex:facet>     
          <apex:inputCheckBox value="{!s.Selected}" /> <!--not binding...-->
     </apex:column>
     <apex:column title="Name">
          <apex:facet name="header">Name</apex:facet>
          <apex:outputText value="{!s.DisplayName}" />
     </apex:column>
</apex:pageBlockTable>

 

Here's the relevant APEX:

//Wrapper

public class reportCardWrapper{
public String displayName {get;set;}
public ID recordID {get;set;}
public ID selectedReportingPeriod {get;set;}
public boolean selected {get;set;}
public list<selectOption> reportingPeriods {get;set;}

public reportCardWrapper(string dn, ID rid){
this.selected = false; //this stopped binding for some reason
this.recordID = rid;
this.displayName = dn;
this.reportingPeriods = new List<selectOption>();
selectedReportingPeriod = null;
}

}

//Loop that checks for "selected"

boolean bSchoolOrGradeSelected = false;
for(reportCardWrapper rw : schoolListChoices){
     if(rw.selected){ //should be true because of the checkbox tied to it on the page.
          schoolToSelectedReportingPeriod.put(rw.recordID,rw.selectedReportingPeriod);
          if(bSchoolOrGradeSelected){//add to the or statement     
               query += ' OR Student__r.School__c = \'' + rw.recordID + '\'';
          }
          else{
               query += ' Student__r.School__c = \'' + rw.recordID + '\'';
               bSchoolOrGradeSelected = true;//this never goes true because the selected value wont bind
           }
     }
}

There is no salesforce error, the only error I get is the one I wrote that checks to make sure at least one box is selected (by looping thru the wrappers and checking the "selected" field. I have another section of the page that has similar logic, but uses datatables instead of pageblocktable, which also has the same issue suddenly.

 

What is going on SF?!

 

Thanks,

Jimmy

I had a bit of trouble finding the solution to my relativley simple problem, set up a bunch of default objects via a static resource instead of using the data loader.

 

This page was useful, it focuses on creating and reading from a csv via apex:inputFile

http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html

 

Turns out you can simply query the static resources and split it all up manually so long as you know the order of the fields in the CSV (my static resource is a straight-up csv, no zip)

 

 

        StaticResource defaultResource = [Select  s.Body From StaticResource s where s.Name LIKE 'resourceName%'];
        blob tempB = defaultResource.Body;
       	String contentFile = tempB.toString();
       	String[] filelines = contentFile.split('\n');
    	List<object_to_Create__c> defaults = new List<object_to_Create__c>();
       	for (Integer i=1;i<filelines.size();i++)
        {
        	object_to_Create__c temp = object_to_Create__c();
                String[] inputvalues = filelines[i].split(',');
        	temp.Field1__c = inputValues[0];
        	temp.Field2__c = inputValues[1];
        	defaults.add(temp);	
        }
        insert defaults;

 I hope this saves some developers time, because i was suprised as to how little i was able to find out there

 

 

I'm developing a page with a bit of jQuery and I'm having trouble with having trouble with jQuery sliders in a repeat. I don't think i'm traversing the DOM correctly.

 

Below is the visualforce code, the red text has the div, which is where the slider is rendered, and the inputText is where the value is to be shown.

 

 

<table>
	<tr>
          <td>
             Weighting for "{!assignmentToCreate.Name}"
          </td>
          <td>
          <div class ="weightSlider"></div>
          <input value="{!assignmentToCreate.Weighting_Value__c}" type="text"/>
          </td>
        </tr>
        <apex:repeat value="{!standardConfigs}" var="sta">
          <tr>
            <td>
               Weighting for "{!sta.Standard__c}"
            </td>
            <td>
              <div class ="weightStandardSlider"></div>
              <input value="{!sta.Default_Weighting__c}" type="text"/>
             </td>
           </tr>
         </apex:repeat>
 </table>

 Here's the javascript

function popUpWeights() {
        j$( "div.weightSlider" ).slider({
                value:1,
                min: 1,
                max: 10,
                slide: function( event, ui ) {
                    j$( "div.weightSlider" ).next().val(ui.value );
                }
            });
        j$( "div.weightStandardSlider" ).slider({
                value:1,
                min: 1,
                max: 10,
                slide: function( event, ui ) {
                    j$( "div.weightStandardSlider" ).next("input").val(ui.value );
                }
            });

        j$( "#weighting" ).dialog({modal: true});
        
    }

 The red text is where the code for the sliders within the repeat, the slider code above it works fine because it is not in the repeat. The blue text is what I think is wrong. The sliders all render but moving any one of them changes the value of the inputText field for ALL of them. 
Can I index the repeat and put the red javascript code in a for loop or something? I've been stuck on this for far too long...

 

 

 

I've run into an issue that is baffling and frustrating. I've got a pageblocktable that simply shows a few elements of a wrapper class that includes some selectoptions, display strings, and most importantly a boolean that is tied to a checkbox. I just discovered that the checkbox values are not binding to the booleans in the wrapper (they were last week), which totally breaks the page and sucks. Please help me...

 

here's the visualforce code: 

<apex:pageBlockTable title="Select School(s)" var="s" value="{!schoolListChoices}">
     <apex:column title="Select">     
          <apex:facet name="header">Select</apex:facet>     
          <apex:inputCheckBox value="{!s.Selected}" /> <!--not binding...-->
     </apex:column>
     <apex:column title="Name">
          <apex:facet name="header">Name</apex:facet>
          <apex:outputText value="{!s.DisplayName}" />
     </apex:column>
</apex:pageBlockTable>

 

Here's the relevant APEX:

//Wrapper

public class reportCardWrapper{
public String displayName {get;set;}
public ID recordID {get;set;}
public ID selectedReportingPeriod {get;set;}
public boolean selected {get;set;}
public list<selectOption> reportingPeriods {get;set;}

public reportCardWrapper(string dn, ID rid){
this.selected = false; //this stopped binding for some reason
this.recordID = rid;
this.displayName = dn;
this.reportingPeriods = new List<selectOption>();
selectedReportingPeriod = null;
}

}

//Loop that checks for "selected"

boolean bSchoolOrGradeSelected = false;
for(reportCardWrapper rw : schoolListChoices){
     if(rw.selected){ //should be true because of the checkbox tied to it on the page.
          schoolToSelectedReportingPeriod.put(rw.recordID,rw.selectedReportingPeriod);
          if(bSchoolOrGradeSelected){//add to the or statement     
               query += ' OR Student__r.School__c = \'' + rw.recordID + '\'';
          }
          else{
               query += ' Student__r.School__c = \'' + rw.recordID + '\'';
               bSchoolOrGradeSelected = true;//this never goes true because the selected value wont bind
           }
     }
}

There is no salesforce error, the only error I get is the one I wrote that checks to make sure at least one box is selected (by looping thru the wrappers and checking the "selected" field. I have another section of the page that has similar logic, but uses datatables instead of pageblocktable, which also has the same issue suddenly.

 

What is going on SF?!

 

Thanks,

Jimmy

I had a bit of trouble finding the solution to my relativley simple problem, set up a bunch of default objects via a static resource instead of using the data loader.

 

This page was useful, it focuses on creating and reading from a csv via apex:inputFile

http://www.forcetree.com/2010/08/read-and-insert-records-from-csv-file.html

 

Turns out you can simply query the static resources and split it all up manually so long as you know the order of the fields in the CSV (my static resource is a straight-up csv, no zip)

 

 

        StaticResource defaultResource = [Select  s.Body From StaticResource s where s.Name LIKE 'resourceName%'];
        blob tempB = defaultResource.Body;
       	String contentFile = tempB.toString();
       	String[] filelines = contentFile.split('\n');
    	List<object_to_Create__c> defaults = new List<object_to_Create__c>();
       	for (Integer i=1;i<filelines.size();i++)
        {
        	object_to_Create__c temp = object_to_Create__c();
                String[] inputvalues = filelines[i].split(',');
        	temp.Field1__c = inputValues[0];
        	temp.Field2__c = inputValues[1];
        	defaults.add(temp);	
        }
        insert defaults;

 I hope this saves some developers time, because i was suprised as to how little i was able to find out there

 

 

I've run into an issue that is baffling and frustrating. I've got a pageblocktable that simply shows a few elements of a wrapper class that includes some selectoptions, display strings, and most importantly a boolean that is tied to a checkbox. I just discovered that the checkbox values are not binding to the booleans in the wrapper (they were last week), which totally breaks the page and sucks. Please help me...

 

here's the visualforce code: 

<apex:pageBlockTable title="Select School(s)" var="s" value="{!schoolListChoices}">
     <apex:column title="Select">     
          <apex:facet name="header">Select</apex:facet>     
          <apex:inputCheckBox value="{!s.Selected}" /> <!--not binding...-->
     </apex:column>
     <apex:column title="Name">
          <apex:facet name="header">Name</apex:facet>
          <apex:outputText value="{!s.DisplayName}" />
     </apex:column>
</apex:pageBlockTable>

 

Here's the relevant APEX:

//Wrapper

public class reportCardWrapper{
public String displayName {get;set;}
public ID recordID {get;set;}
public ID selectedReportingPeriod {get;set;}
public boolean selected {get;set;}
public list<selectOption> reportingPeriods {get;set;}

public reportCardWrapper(string dn, ID rid){
this.selected = false; //this stopped binding for some reason
this.recordID = rid;
this.displayName = dn;
this.reportingPeriods = new List<selectOption>();
selectedReportingPeriod = null;
}

}

//Loop that checks for "selected"

boolean bSchoolOrGradeSelected = false;
for(reportCardWrapper rw : schoolListChoices){
     if(rw.selected){ //should be true because of the checkbox tied to it on the page.
          schoolToSelectedReportingPeriod.put(rw.recordID,rw.selectedReportingPeriod);
          if(bSchoolOrGradeSelected){//add to the or statement     
               query += ' OR Student__r.School__c = \'' + rw.recordID + '\'';
          }
          else{
               query += ' Student__r.School__c = \'' + rw.recordID + '\'';
               bSchoolOrGradeSelected = true;//this never goes true because the selected value wont bind
           }
     }
}

There is no salesforce error, the only error I get is the one I wrote that checks to make sure at least one box is selected (by looping thru the wrappers and checking the "selected" field. I have another section of the page that has similar logic, but uses datatables instead of pageblocktable, which also has the same issue suddenly.

 

What is going on SF?!

 

Thanks,

Jimmy

I have an application where the user creates a zip file of various images to be used on a Sites page, and then loads this as Static Resource.

 

Right now, to use the images, the user has to enter the exact, complete name (case matters) of the file name in the zip file to incorporate an image on the Sites Page. These specifications are maintained in a separate object.

 

What I would like to do is present the user with a picklist of the files in the static resource. This would eliminate a lot of errors.

 

But there does not seem to be a way to do this in Apex.

 

Any ideas? Anyone?

I'm developing a page with a bit of jQuery and I'm having trouble with having trouble with jQuery sliders in a repeat. I don't think i'm traversing the DOM correctly.

 

Below is the visualforce code, the red text has the div, which is where the slider is rendered, and the inputText is where the value is to be shown.

 

 

<table>
	<tr>
          <td>
             Weighting for "{!assignmentToCreate.Name}"
          </td>
          <td>
          <div class ="weightSlider"></div>
          <input value="{!assignmentToCreate.Weighting_Value__c}" type="text"/>
          </td>
        </tr>
        <apex:repeat value="{!standardConfigs}" var="sta">
          <tr>
            <td>
               Weighting for "{!sta.Standard__c}"
            </td>
            <td>
              <div class ="weightStandardSlider"></div>
              <input value="{!sta.Default_Weighting__c}" type="text"/>
             </td>
           </tr>
         </apex:repeat>
 </table>

 Here's the javascript

function popUpWeights() {
        j$( "div.weightSlider" ).slider({
                value:1,
                min: 1,
                max: 10,
                slide: function( event, ui ) {
                    j$( "div.weightSlider" ).next().val(ui.value );
                }
            });
        j$( "div.weightStandardSlider" ).slider({
                value:1,
                min: 1,
                max: 10,
                slide: function( event, ui ) {
                    j$( "div.weightStandardSlider" ).next("input").val(ui.value );
                }
            });

        j$( "#weighting" ).dialog({modal: true});
        
    }

 The red text is where the code for the sliders within the repeat, the slider code above it works fine because it is not in the repeat. The blue text is what I think is wrong. The sliders all render but moving any one of them changes the value of the inputText field for ALL of them. 
Can I index the repeat and put the red javascript code in a for loop or something? I've been stuck on this for far too long...