Page 6 of 7

Working with plugins

Posted: Wed Jun 10, 2015 6:21 pm
by umama fakher

Hey can you help me increasing the star size a little bit?


Working with plugins

Posted: Wed Jun 10, 2015 8:16 pm
by umama fakher

Can you help me saving the rating in my database ?

It will be great to hear from you soon!


Working with plugins

Posted: Thu Jun 11, 2015 2:13 pm
by umama fakher

can you please tell me which value of JSON? And also the Mapping part?

Thanks!


Working with plugins

Posted: Thu Jun 11, 2015 3:56 pm
by Mark MB

Hi umama. Glad it helped but not sure what strategy you are using for your database. I imagine you are already saving other types of data to your database, if so then it would be mater of getting the selected rating value out to some variable so you can use it anywhere you want. You can either use a variable, read it into a hidden label field or to have it globally available store it in LocalStorage (may be over kill). I would use the auto submit type of star which allows you to provide a callback within which you can do anything you want. Replace the previous code with this:

Code: Select all

        <link type="text/css" rel="stylesheet" href="files/views/assets/css/jquery.rating.css"/> 
     <script type="text/javascript" src="files/views/assets/js/jquery.rating.js"> 
     </script> 
     <script type="text/javascript" src="files/views/assets/js/jquery.rating.pack.js"> 
     </script> 

 <script> 

$(function(){
$('.auto-submit-star').rating(
{
callback: function(value, link)
{

Code: Select all

         alert("The value selected was '" + value); 
          // Store it in some hidden fields. i.e. a hiddlen lable component named lblTest 
         Apperyio('lblTest').text(value); 
         // Or 
         localStorage.setItem ("Selected_Rating_Value", value ); 
     } 

});
});
</script>

Code: Select all

 <input class="auto-submit-star" type="radio" name="star1" value ="1"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="2"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="3"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="4"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="5" />

Working with plugins

Posted: Thu Jun 11, 2015 7:56 pm
by umama fakher

Wow !! ..Thank you so much, it is working :) !!

Can you also tell me how to create two different rating star on the same page ?

I am really glad and I am so thankful to you in helping and resolving this problem to this point. Stay blessed and Happy :) !!


Working with plugins

Posted: Thu Jun 11, 2015 10:55 pm
by Mark MB

Not sure what you mean by two different rating stars. If you mean two different sets then you should name the sets differently. In the example above the set is named "Star1", the new set should have another name assigned to all its stars. You can use the same function to see which set was clicked on by using the "this.name:" as follows:
<script>
$(function(){
$('.auto-submit-star').rating(
{
callback: function(value, link)
{

Code: Select all

         alert("The rating name = " + this.name + " value:" + value); 

     } 

});
});
</script>
<p>

Code: Select all

 <input class="auto-submit-star" type="radio" name="star1" value ="1"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="2"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="3"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="4"/> 
 <input class="auto-submit-star" type="radio" name="star1" value ="5" /> 

  <br> 
  <br>     
 <input class="auto-submit-star" type="radio" name="star2" value ="1"/> 
 <input class="auto-submit-star" type="radio" name="star2" value ="2"/> 
 <input class="auto-submit-star" type="radio" name="star2" value ="3"/> 

/>


Working with plugins

Posted: Fri Jun 12, 2015 4:15 pm
by umama fakher

Thankyou So much Mark ! It is working awesome :) ! StayBlessed !!


Working with plugins

Posted: Tue Jun 16, 2015 5:57 pm
by Serhii Kulibaba

Umama,

Could you clarify what have you tried and what exactly does not work?


Working with plugins

Posted: Sun Jun 21, 2015 7:52 pm
by umama fakher

Hey this problem was solved :) .. Thanks!


Working with plugins

Posted: Sun Jun 21, 2015 7:53 pm
by umama fakher

Mark only last thing .. can I increase the size of the stars through javascript ?