This topic is locked

Stars for rate

3/21/2012 6:29:03 AM
PHPRunner General questions
S
sickacid author

Hi, It's possible insert into a page the classic 5 stars to rate something? such as Itunes.

Eventually you have to edit the page or you can do directly from the visualization?

C
cgphp 3/21/2012
S
sickacid author 3/22/2012

Hi, isn't wery clear how to integrate this script with phprunner <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65153&image=1&table=forumreplies' class='bbc_emoticon' alt=':(' />

I've see the steps to follow here: http://www.yvoschaap.com/weblog/css_star_rater_ajax_version/

but I don't know where to put some code.

C
cgphp 3/22/2012

It looks very easy to me: http://www.fyneworks.com/jquery/star-rating/
Some radio buttons and one line of javascript. What else do you want? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65156&image=1&table=forumreplies' class='bbc_emoticon' alt=':lol:' />

S
sickacid author 3/22/2012



It looks very easy to me: http://www.fyneworks.com/jquery/star-rating/
Some radio buttons and one line of javascript. What else do you want? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65160&image=1&table=forumreplies' class='bbc_emoticon' alt=':lol:' />


I've unpaked in the project\source the zip file star-rating.zip

I've created a field named star1 as INT and in the editor and put it as Radio button

I've put the follow code in Javascript on load event:
<input name="star1" type="radio" class="star"/>

<input name="star1" type="radio" class="star"/>

<input name="star1" type="radio" class="star"/>

<input name="star1" type="radio" class="star"/>

<input name="star1" type="radio" class="star"/>
But if i compile that i get an error, and i see only the radio button

C
cgphp 3/22/2012

Check this article to include external javascript file in your project: http://xlinesoft.com/phprunner/docs/how_to_add_external_files.htm
The input radio buttons goes in the HTML source code not in the event.

In the "Javascript onload" event add the following code:

$('input.star').rating();
S
sickacid author 3/23/2012



Check this article to include external javascript file in your project: http://xlinesoft.com/phprunner/docs/how_to_add_external_files.htm
The input radio buttons goes in the HTML source code not in the event.

In the "Javascript onload" event add the following code:

$('input.star').rating();



Don't works <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65171&image=1&table=forumreplies' class='bbc_emoticon' alt=':ph34r:' />

I've unpaked in the project\source the zip file star-rating.zip

I've created a field named star1 as INT and in the editor and put it as Radio button

I've put this code in javascript on load event: $('input.star').rating();

In html editor I've put this code at the end: <script src="include/rating.js" type=text/javascript></SCRIPT>{END body} </BODY></HTML>

In html editor I've put this code <input name="star1" type="radio" class="star"/> after <TD class="runner-cc alt">{$star1_editcontrol}

but i see only another radio button.. any suggestion? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65171&image=2&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />

C
cgphp 3/23/2012

Check firebug for errors.

S
sickacid author 3/24/2012

Hi! rating.js doesn't work if used with add/edit/view POPUP. Now I've check the code and I can view the stars <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65206&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />

But it doesen't work with db and I don't know why <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=65206&image=2&table=forumreplies' class='bbc_emoticon' alt=':unsure:' />

C
cgphp 3/24/2012

Have you added the radio buttons as custom fields to the form of the add/edit/view pages? Check this article for more info: http://xlinesoft.com/phprunner/docs/add_custom_field_to_form.htm

S
sickacid author 3/26/2012



Have you added the radio buttons as custom fields to the form of the add/edit/view pages? Check this article for more info: http://xlinesoft.com/phprunner/docs/add_custom_field_to_form.htm


Hi, I've do this in VIEW page
in html editor

<script language=javascript type=text/javascript src="jquery.js"></SCRIPT>

<script language=javascript type=text/javascript src="jquery.rating.js"></SCRIPT>

<script language=javascript type=text/javascript src="jquery.MetaData.js"></SCRIPT>

<LINK rel=stylesheet type=text/css href="jquery.rating.css">

this before /HEAD TAG
after {$star1_value} tag:

<input name="star1" type="radio" class="star" disabled="disabled"/>

<input name="star1" type="radio" class="star" disabled="disabled"/>

<input name="star1" type="radio" class="star" disabled="disabled"/>

<input name="star1" type="radio" class="star" disabled="disabled"/>

<input name="star1" type="radio" class="star" disabled="disabled"/>
on JS on load event

$('input.star').rating();

this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){
var val = $("#star1").val();

formObj.baseParams['star1'] = val;

});
and in before process:

global $conn;

$_SESSION["star1"]==$_REQUEST["star1"];
With this code i see the star correctly disabled but the star isn't fielled with the value (in this case number 4) stored in the db field named star1.