Code issue only on mobile version

Hello everyone. I’m glad this kind of forum still exists !
Before I begin, keep in mind that I am an explorer, allways trying things, so my code is, I guess, not well structured ^^.

So, I have a choir site, wich provide, in a restricted area, access to all song we are working with ( mp3, pdf ) . I made a database with song , it stocks informations such as links for every voice ( soprano 1, soprano 2 … ) . Sometimes , there is 2 soprano voices, sometimes not .

So for every voice, i made a boolean (f.e. is2Alto ) . I don’t know, for now, why with the boolean i had some issues, so i put a char instead :wink: and i enter “true” or “false” manually

I display my songs in a repeater.

I made this part of code the check if there is 2 soprano voice, then it will display a part of soprano stuff.

" let itemObj = $w ( “#dataset1” ). getCurrentItem ();
let TestSoprano = itemObj . is2Soprano ;

if ( TestSoprano = “true” ){ $w ( ‘#Sop2mp3’ ). show (); $w ( ‘#Sop2pdf’ ). show (); $w ( ‘#Sop2music’ ). show ();}
if ( TestSoprano = “false” ){ $w ( ‘#Sop2mp3’ ). hide (); $w ( ‘#Sop2pdf’ ). hide (); $w ( ‘#Sop2music’ ). hide ();}"

So , this i actually working on Computer version, but it’s not working on mobile.
I am wondering why :slight_smile: If you have some clue I’ll take it , thank you :).

Julien.

Need to see more of your code in order to better understand what you are trying to do. Please post your code, nicely formatted, here in a code block.

No problem :wink: Thanks for answering ,
I have 5 other similar code block, for each buttons.

$w('#Sopbutton').onClick( () => { //each song has 6 buttons ,to choose your staff 
// i only want to show the part you choose, so i hide every other 
// when the button is pushed, i change de background , and set others to normal
        if ($w('#tuttibox').isVisible =true ) {  $w('#tuttibox').hide("fade");
                      $w('#Tuttibutton').style.backgroundColor = "#969696";}
        if ($w('#instrubox').isVisible =true ) {  $w('#instrubox').hide("fade");
                      $w('#Instrubutton').style.backgroundColor = "#969696"; }
        if ($w('#Altbox').isVisible =true ) {  $w('#Altbox').hide("fade"); 
                      $w('#Altbutton').style.backgroundColor = "#969696"; }
        if ($w('#Tenorbox').isVisible =true ) {  $w('#Tenorbox').hide("fade");
                      $w('#Tenorbutton').style.backgroundColor = "#969696"; }
        if ($w('#BasBox').isVisible =true ) {  $w('#BasBox').hide("fade");    
                      $w('#Basbutton').style.backgroundColor = "#969696"; }
        $w('#Sopbutton').style.backgroundColor = "#A86251";
        $w('#Sopbox').show("fade");

 let itemObj = $w("#dataset1").getCurrentItem();
 let TestSoprano = itemObj.is2Soprano;
 
 if (TestSoprano = "true"){ $w('#Sop2mp3').show();
                              $w('#Sop2pdf').show(); $w('#Sop2music').show();} 
 if (TestSoprano = "false"){ $w('#Sop2mp3').hide();
                              $w('#Sop2pdf').hide(); $w('#Sop2music').hide();} 
 });




You say that your songs are displayed in a Repeater. Does that mean that #SopButton is a button in the Repeater? If so, you will need to use the Repeated Item Scope . To see how to handle a button click from a Repeater, see Retrieve Repeater Item Data When Clicked .

Yes, the buttons are on the repeater .

Oh , ok , I’m gonna explore this path, thank you for answering again.

Consider taking a look at the Input Repeaters example during your explorations.

Thanks to you, I was Able to make things works ! Thanks you so much @yisrael-wix !

Can I ask you one more Question ? Is there a way to choose (with a boolean on my db ) if a line of my db will be displayed on my repeater or not ?

You can filter the dataset that is connected to the Repeater, to only display items that have the boolean set to true. Something like this:

$w("#dataset1").setFilter( wixData.filter()
  .eq("display", true)
);

See the setFilter() API for more information.

again, Thanks you :wink: