• Genesis Yau
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 5
    Replies
I want to write a JQuery function that requires a list of strings like:
[
"string1",
"string2",
"string3",
"string4"
]
Since the list is quite long, I was wondering if I could just add a static resource on Salesforce containing the array and then retrieve it from my JQuery code.

I tried creating a static resource containing the exact same content above and tried to get its content by writing:
var testList = "{!URLFOR($Resource.testList)}";
console.log(testList);
However, the browser console only shows the URL
/test/resource/*****************/testCList



 
I want to create a table that displays some time slots with a checkbox next to it. At the end of the table, there's a submit button. For the table, I used a Schedule__c object and also declared a Map, with the boolean being the default value for the checkbox.
This is the UI:
UI

This is a part of my VF code:
<apex:form id="results">
            <!-- <apex:outputText rendered="{!availableCourses.size == 0}" value="{!$Label.noResults}" /> -->
            <br/>
            <table style="width:100%">
                <thead>
                    <th>{!$Label.timeSlot}</th>
                    <th>{!$Label.courseStatus}</th>
                    <th>chose</th>
                </thead>
                <tbody>
                    <apex:repeat value="{!availableCourses}" var="result">
                        <apex:param value="{!courseOptions}"/>
                        <tr>
                            <td class="courseTime">
                                <apex:outputText value="{!result.Time__c}"></apex:outputText>
                            </td>
                            <td>test</td>
                            <td><apex:inputCheckbox value="{!courseOptions[result]}"/></td>
                        </tr>
                    </apex:repeat>
                </tbody>
            </table>
            <br/>
        </apex:form>
        <apex:form>
            <apex:commandButton value="{!$Label.submit}" action="{!Submit}" styleClass="btn btn-block" style="margin:0px;">

            </apex:commandButton>
        </apex:form>

This is part of my controller:
This is where I assign the default values to the Map, which has no problems at all.
for(ScheduleSetting__c a: availableCourses){
        courseOptions.put(a, false);
}

This is supposed to be my Submit function. It's not done yet because I'm trying to get the new values for the input checkboxes first.
 
public Pagereference Submit() {
    system.debug('aaa');

    for(ScheduleSetting__c key : courseOptions.keySet()){
        system.debug(courseOptions.get(key));
    }
    return null;
}
The problem is that even though I check the inputCheckBox when Submit gets called, the Map values don't change at all. I just want to be able to change the Map Boolean values depending on whether the checkbox is checked or not.
This is what I get in the Logs:
User-added image
 
I want to write a JQuery function that requires a list of strings like:
[
"string1",
"string2",
"string3",
"string4"
]
Since the list is quite long, I was wondering if I could just add a static resource on Salesforce containing the array and then retrieve it from my JQuery code.

I tried creating a static resource containing the exact same content above and tried to get its content by writing:
var testList = "{!URLFOR($Resource.testList)}";
console.log(testList);
However, the browser console only shows the URL
/test/resource/*****************/testCList



 
I want to create a table that displays some time slots with a checkbox next to it. At the end of the table, there's a submit button. For the table, I used a Schedule__c object and also declared a Map, with the boolean being the default value for the checkbox.
This is the UI:
UI

This is a part of my VF code:
<apex:form id="results">
            <!-- <apex:outputText rendered="{!availableCourses.size == 0}" value="{!$Label.noResults}" /> -->
            <br/>
            <table style="width:100%">
                <thead>
                    <th>{!$Label.timeSlot}</th>
                    <th>{!$Label.courseStatus}</th>
                    <th>chose</th>
                </thead>
                <tbody>
                    <apex:repeat value="{!availableCourses}" var="result">
                        <apex:param value="{!courseOptions}"/>
                        <tr>
                            <td class="courseTime">
                                <apex:outputText value="{!result.Time__c}"></apex:outputText>
                            </td>
                            <td>test</td>
                            <td><apex:inputCheckbox value="{!courseOptions[result]}"/></td>
                        </tr>
                    </apex:repeat>
                </tbody>
            </table>
            <br/>
        </apex:form>
        <apex:form>
            <apex:commandButton value="{!$Label.submit}" action="{!Submit}" styleClass="btn btn-block" style="margin:0px;">

            </apex:commandButton>
        </apex:form>

This is part of my controller:
This is where I assign the default values to the Map, which has no problems at all.
for(ScheduleSetting__c a: availableCourses){
        courseOptions.put(a, false);
}

This is supposed to be my Submit function. It's not done yet because I'm trying to get the new values for the input checkboxes first.
 
public Pagereference Submit() {
    system.debug('aaa');

    for(ScheduleSetting__c key : courseOptions.keySet()){
        system.debug(courseOptions.get(key));
    }
    return null;
}
The problem is that even though I check the inputCheckBox when Submit gets called, the Map values don't change at all. I just want to be able to change the Map Boolean values depending on whether the checkbox is checked or not.
This is what I get in the Logs:
User-added image