can't seem to get the select change to update the location field based on the repeater location section. No errors it simply does not change the location(tfa_4) drop-down to equal the repeater Location (tfa_1025)

        //I have a repeater Fieldset Section tfa_1025 where fields like Event Name, Location are displayed

        //with all the campaigns the logged in owner owns

        // When the selected event is changed.



             function() { 

                 var dropdownIndex = dropdownCampaign.selectedIndex; // Index of the currently selected event

                 console.log("Current event info:\nEvent Name: " + eventNames[dropdownIndex-1]+"\nLocation: " + eventLocations[dropdownIndex-1] + "\nStatus: " + eventStatus[dropdownIndex-1] + "\nType: " + eventTypes[dropdownIndex-1] + "\nStart Date: " + eventStartDates[dropdownIndex-1] + "\nEnd Date: " + eventEndDates[dropdownIndex-1]+ "\nStart Time: " + eventStartTimes[dropdownIndex-1] + "\nEnd Time: " + eventEndTimes[dropdownIndex-1]);

                 // Logic to prefill the event name using the currently selected event field tfa_8

                 document.getElementById("tfa_8").value = eventNames[dropdownIndex-1];


                // Logic to prefill the location dropdown (tfa_4) using the currently selected event

                //tfa_1025 is the Fieldset Section displaying campaign info from owner

                  if (eventLocations[dropdownIndex-1] == "Oshawa") { 

                      SelectElement("tfa_4", "tfa_1025");

                  } else if (eventLocations[dropdownIndex-1] == "Pickering") {

                      SelectElement("tfa_4", "tfa_1025");

                  } else if (eventLocations[dropdownIndex-1] == "Whitby") {

                      SelectElement("tfa_4", "tfa_1025");



  • 2
    As is, I'm not entirely sure that this is on-topic for Salesforce. Can you please clarify how this relates to Salesforce? – Derek F Oct 3 '18 at 18:03
  • Indirectly related as the mapped dropdown list records are coming from Salesforce. Regardless of where it's coming from I thought I could get some feedback on the Javascript syntax part of my issue. Hoping that someone here knows a lot more about manipulating JavaScript dropdowns that I do. – Robert Wynter Oct 3 '18 at 18:25

resolved with:

// When the selected event is changed



function getSelectedValue(){
var x = document.getElementById("tfa_43").selectedIndex; var y = document.getElementById("tfa_43").options;

//pulls the status with a matching index from the status array var statusToFind = eventStatus[x]; var dd = document.getElementById('tfa_14');

for (var i = 0; i < dd.options.length; i++) { console.log("Current event info:\oPTIONlENGTH: " + dd); if (dd.options[i].text === statusToFind) {

    dd.selectedIndex = i;

} return; } );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.