-1

I've just installed and added this plugin to one of my pages:

http://www.fyneworks.com/jquery/star-rating/#tab-API

The form control works perfect, my radio buttons are now stars. However, I cannot figure out how to get it to submit with the form. Each radio button gets the same name in order to group them into the same set of stars.

I'd like to avoid using ajax here if possible. I have other data I want the form to submit too so I would like to use just a normal HTML form submit and handle the data from POST.

Anyone have any idea?

Steve
  • 121
  • 8

1 Answers1

1

Well, I did this and it worked:

<form action="/testurl" method="get" accept-charset="utf-8">    
  <input type="radio" name="rating" value="1">
  <input type="radio" name="rating" value="2">
  <input type="radio" name="rating" value="3">
  <input type="radio" name="rating" value="4">
  <input type="radio" name="rating" value="5">

  <p><input type="submit" id="submit" value="Continue &rarr;"></p>
</form>

<script type="text/javascript" charset="utf-8">
  $(document).ready(function(){
    $(":radio").rating();
    $('form').on('submit', function(e) {
      e.preventDefault();
      $(this).ajaxSubmit();
    });
  });
</script>

And when I submit the form the value of rating is passed correctly: /testurl?rating=2

thitemple
  • 5,833
  • 4
  • 42
  • 67