Hello, coders! I have created a custom form that my clients will use to send messages from within their portal. When the Message Form is submitted, the content is displayed in a repeater which is displayed on a standard page titled “Message History”. The Messages dataset is filtered so that only members connected with the senders Client Name are able to view the messages that have been sent. Users are given the option to respond to the messages by clicking a button which when clicked, allows a hidden reply box to be shown. They are required to select their Client Name and the name of the intended recipient from dropdown lists before they are able to type their message into the reply box. When they click the submit button, they are directed to a dynamic page which displays original message, and the first response. They are given the opportunity to add to the conversation, by clicking a button which displays another reply box which is set up like the first one I described.
I am using the Cascading dropdown feature to filter the recipient dropdown options on both the original Message box and on all of the Reply boxes. The filtering works exactly as expected on the first Message box: Because of the filter I have applied to the Message Dataset, the only available selection for the Company Name dropdown, is the Company with which they are associated in the Profile collection. The only options available for them to select in the Recipient dropdown are those which are listed as options I have listed as options in the backend as options for the Company which has been entered in the Company Name dropdown.
My problem is with Recipient options being displayed in the reply boxes. For some reason, the Recipient dropdown options are not those that I’ve listed for the Company in the backend. I’m hoping that someone would be willing to review my code and the screenshots I’ve inlcuded in this post and help me figure out what I’ve done wrong.
Here’s a video that can help you understand my vision for the related pages:
https://www.screencast.com/t/GgncSHgc
Here’s my backend code (companies.js):
export const ccahUsers = [
{value:"", label: "Select a CCAH User"},
{value:"hsmith@chog.org", label: "Pastor Handel Smith"},
{value:"dqsi1@aol.com", label: "Rev. Sharon Montgomery"},
{value:"admin@ccarrowheights.com", label: "Church Admin"},
{value:"admin@writeitrightsite.com", label: "WIR - Virtual Admin"},
];
export const agUsers = [
{value:"", label: "Select an AG User"},
{value:"emilynichols-mitchell@accelerationsgroup.com", label: "Emily Nichols-Mitchell"},
{value:"clientcareteam@accelerationsgroup.com", label: "Client Care Team"},
{value:"admin@writeitrightsite.com", label: "WIR - Virtual Admin"},
];
export const testUsers = [
{value:"", label: "Select a User"},
{value:"jjtaylor@anderson.edu", label: "Jane Doe"},
{value:"admin@writeitrightsite.com", label: "WIR - Virtual Admin"},
];
Here’s the code for the original Message page (Working Properly):
import {ccahUsers, agUsers, testUsers} from 'public/companies';
//Cascading Dropdowns
$w.onReady(function () {
$w('#emailSender').options = ccahUsers;
$w('#companies').onChange(() => {
if ($w('#companies').value === 'Celebration Church at Arrow Heights') {
$w('#emailSender').options = ccahUsers;
$w('#emailSender').placeholder = '';
$w('#emailSender').enable();
$w('#emailPrimaryRecipient').options = ccahUsers;
$w('#emailPrimaryRecipient').placeholder = '';
$w('#emailPrimaryRecipient').enable();
$w('#cc1Email').options = ccahUsers;
$w('#cc1Email').placeholder = '';
$w('#cc1Email').enable();
$w('#cc2Email').options = ccahUsers;
$w('#cc2Email').placeholder = '';
$w('#cc2Email').enable();
$w('#cc3Email').options = ccahUsers;
$w('#cc3Email').placeholder = '';
$w('#cc3Email').enable();
}
else if ($w('#companies').value === 'Accelerations Group') {
$w('#emailSender').options = agUsers;
$w('#emailSender').placeholder = '';
$w('#emailSender').enable();
$w('#emailPrimaryRecipient').options = agUsers;
$w('#emailPrimaryRecipient').placeholder = '';
$w('#emailPrimaryRecipient').enable();
$w('#cc1Email').options = agUsers;
$w('#cc1Email').placeholder = '';
$w('#cc1Email').enable();
$w('#cc2Email').options = agUsers;
$w('#cc2Email').placeholder = '';
$w('#cc2Email').enable();
$w('#cc3Email').options = agUsers;
$w('#cc3Email').placeholder = '';
$w('#cc3Email').enable();
}
else if ($w('#companies').value === 'Test Client A') {
$w('#emailSender').options = testUsers;
$w('#emailSender').placeholder = '';
$w('#emailSender').enable();
$w('#emailPrimaryRecipient').options = testUsers;
$w('#emailPrimaryRecipient').placeholder = '';
$w('#emailPrimaryRecipient').enable();
$w('#cc1Email').options = testUsers;
$w('#cc1Email').placeholder = '';
$w('#cc1Email').enable();
$w('#cc2Email').options = testUsers;
$w('#cc2Email').placeholder = '';
$w('#cc2Email').enable();
$w('#cc3Email').options = testUsers;
$w('#cc3Email').placeholder = '';
$w('#cc3Email').enable();
}
else {
$w('#emailSender').value = '';
$w('#emailSender').disable();
$w('#emailPrimaryRecipient').value = '';
$w('#emailPrimaryRecipient').disable();
$w('#cc1Email').value = '';
$w('#cc1Email').disable();
$w('#cc2Email').value = '';
$w('#cc2Email').disable();
$w('#cc3Email').value = '';
$w('#cc3Email').disable();
}
});
});
Here’s the code for the Message History page (Problem Page):
import {ccahUsers, agUsers, testUsers} from 'public/companies';
//Cascading Dropdowns
$w.onReady(function () {
$w('#nameResponder1').options = ccahUsers;
$w('#companies2').onChange(() => {
if ($w('#companies2').value === 'Celebration Church at Arrow Heights') {
$w('#nameResponder1').options = ccahUsers;
$w('#nameResponder1').placeholder = '';
$w('#nameResponder1').enable();
}
else if ($w('#companies2').value === 'Accelerations Group') {
$w('#nameResponder1').options = agUsers;
$w('#nameResponder1').placeholder = '';
$w('#nameResponder1').enable();
}
else if ($w('#companies2').value === 'Test Client A') {
$w('#nameResponder1').options = testUsers;
$w('#nameResponder1').placeholder = '';
$w('#nameResponder1').enable();
}
else {
$w('#nameResponder1').value = '';
$w('#nameResponder1').disable();
}
});
});