Errors I am getting
Regarding Fetch after the page loads
Thank you. I just tried it. It did not work. Using my phone to view www.edisonchargerfootball.com/golf-tournament still presents a page with unpopulated elements (specifically those elements who are populated by code output like Date(s) (aka ID: dateStartandEnd) at the top of the page. Would appreciate addition thoughts. Thank you to all who have reviewed my question.
Regarding Checkbox
Good question Yisrael! I did not mention the checkbox because my situation is already so convoluted.
The checkbox is only used by the program organizer. It is the first condition of my code. The checkbox is always hidden on the webpage. It determines two things. First, if a strip with info about the second session is expand and therefore shows on the page. Second, if the dates of the program (Mar 14 - Mar 18, 2022) include a date from the second sessions (Mar 18, 2022 would be the end of the second program).
Could the checkbox be part of the problem?
Declaring Variables Doesn’t work
Another issue - this code didn’t work if I declared variables (other than isChecked). Hence, I had to write the literal element names every time. I am probably doing at least one important thing wrong that might explain all these issue but
… For example, I am trying to learn how to get the data from the dataset or collection and remove the elements’ text properties from the code. I just started learning Java so I am getting up to speed AQAP but have so much to learn.
My code
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( ‘#programs’ ). onReady (() => {
const isChecked = $w ( ‘#checkbox1’ ). checked ;
if ( isChecked ) {
$w ( '#columnStrip39' ). expand ();
if ( $w ( '#session1StartDate' ). text . slice ( 0 , 14 ) === ( $w ( '#session1EndDate' ). text . slice ( 0 , 14 ) && $w ( '#session2EndDate' ). text . slice ( 0 , 14 )))
{ $w ( '#dateStartAndEnd' ). text = $w ( '#session1StartDate' ). text }
**else**
{ $w ( '#dateStartAndEnd' ). text = $w ( '#session1StartDate' ). text . slice ( 0 , 6 ) + " - " + $w ( '#session2EndDate' ). text }
}
**else if** ( isChecked === **false** ) {
$w ( '#columnStrip39' ). collapse ();
if ( $w ( '#session1StartDate' ). text . slice ( 0 , 14 ) === $w ( '#session1EndDate' ). text . slice ( 0 , 14 ))
{ $w ( '#dateStartAndEnd' ). text = $w ( '#session1StartDate' ). text }
**else** { $w ( '#dateStartAndEnd' ). text = $w ( '#session1StartDate' ). text . slice ( 0 , 6 ) + " - " + $w ( '#session1EndDate' ). text }
}
})
});
