jimPC  
                
                  
                    November 29, 2021,  3:08pm
                   
                  1 
               
             
            
              wappler 4.4.1
As part of a star rating function , I have created a repeat column which contains a font awesome fa-star-O. (Empty star)
When this is clicked the variable rating_selected is updated the class toggles to fa-star. (filled star)
This works perfectly within the wappler preview but not when previewed in browser.
Is this a bug???
             
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  3:16pm
                   
                  2 
               
             
            
              Hard to answer what’s wrong without seeing your page or code.
             
            
              
           
          
            
              
                jimPC  
                
                  
                    November 29, 2021,  3:29pm
                   
                  3 
               
             
            
              Screen shot within wappler
screen shot in browser
Star icon onclick:
    <div class="container" style="width: 250px;" id="rating_container">
    <div class="row">
        <div class="col" dmx-repeat:star_repeat="5" id="repeat_star">
            <i class="fa fa-star rating" dmx-class:fa-star-o="($index  >= rating_selected.value)" dmx-class:fa-star="($index  <= rating_selected.value)" dmx-on:click="rating_selected.setValue($index +1)"></i>
        </div>
    </div>
</div>
 
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  3:41pm
                   
                  4 
               
             
            
              What is rating_selected  and where is it located on the page?
Also your both conditions have =, maybe you want to remove it from dmx-class:fa-star="($index  <= rating_selected.value)" so it becomes dmx-class:fa-star="($index  < rating_selected.value)"
             
            
              
           
          
            
              
                jimPC  
                
                  
                    November 29, 2021,  3:57pm
                   
                  5 
               
             
            
              located on same page:
            <i class="fa fa-star rating" dmx-class:fa-star-o="($index+1)  > rating_selected.value" dmx-class:fa-star="($index+1)  < rating_selected.value" dmx-on:click="rating_selected.setValue($index +1)"></i>
this creates the wappler preview:
The stars disappear completely  in the browser.
             
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  4:03pm
                   
                  6 
               
             
            
              That was not what i meant Jim ...= only from one of the expressions!
<i class="fa fa-star rating" dmx-class:fa-star-o="($index  >= rating_selected.value)" dmx-class:fa-star="($index  < rating_selected.value)" dmx-on:click="rating_selected.setValue($index +1)"></i>
also:
             
            
              
           
          
            
              
                jimPC  
                
                  
                    November 29, 2021,  4:14pm
                   
                  7 
               
             
            
              
This works in the wappler preview only (as did the original code) nothing at all is shown in the browser.
The variable rating_selected is updated when the the the star is clicked ,
I use this variable to preload the star rating when viewing previous records.
             
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  4:15pm
                   
                  8 
               
             
            
              Do you have a link where i can test this?
             
            
              
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  4:16pm
                   
                  9 
               
             
            
              sorry Teodor no link available
             
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  4:22pm
                   
                  10 
               
             
            
              Please paste your whole page code here then.
             
            
              
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  4:38pm
                   
                  11 
               
             
            
              Ok it seems the problem originates from the font awesome cdn
I have been using font awesome 5.14.0 - all cdn
When I revert to 4.7.0 cdn it works properly…
Is there a problem with  font awesome 5.14.0 - all cdn,
             
            
              
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  4:45pm
                   
                  12 
               
             
            
              
No, there is no problem wit 5.14 cdn.
             
            
              
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  4:47pm
                   
                  13 
               
             
            
              Yep I think you’re right I will check all the icons I have used, thanks for your help
             
            
              
           
          
            
            
              far fa-star for non filled and fas fa-star for filled work in 5.14.0 I couldn’t get the -o one to display in my tests.
             
            
              
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  4:53pm
                   
                  15 
               
             
            
              Sorry_duh
             
            
              
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  4:57pm
                   
                  16 
               
             
            
              
 Sorry_Duh:
 
far fa-star
 
 
When I enter far fa-star in the class toggle I get the error message 'enter a single valid class name'
             
            
              
           
          
            
            
              You may try this code:
<div class="container" style="width: 250px;" id="rating_container">
                <div class="row">
                    <div class="col" dmx-repeat:star_repeat="5" id="repeat_star">
                        <i class="far fa-star" dmx-on:click="rating_selected.setValue($index)" dmx-class:far="($index  >= rating_selected.value)" dmx-class:fas="($index  <= rating_selected.value)"></i>
                    </div>
                </div>
            </div>
for 5.14.0
Edit: better code format
             
            
              1 Like 
            
           
          
            
              
                Teodor  
              
                  
                    November 29, 2021,  4:58pm
                   
                  18 
               
             
            
              Guys, when posting code please follow How to format code in your posts 
             
            
              1 Like 
            
           
          
            
              
                jimPC  
              
                  
                    November 29, 2021,  5:01pm
                   
                  19 
               
             
            
              
Thankyou Sorry_duh works a treat!!! 
             
            
              1 Like