|
|
#1 |
|
New Member
![]() Join Date: Feb 2009
Posts: 3
|
I have to make a poll with many checkbox'es. I want to use php with AJAX for my purpose.
1)Is it possible to limit number of user choices with the helps of AJAX?I want to accept only 3 choices. how to do that? 2)Is it possible to get order of choices and how? - It's important for me know in which order user choose items of the poll |
|
|
|
|
|
#2 |
|
Super Moderator
![]() Join Date: Jun 2008
Posts: 493
|
You would probably be better using javascript to achieve both of these requirements.
1) Using JS to see how many boxes are checked would be easier then trying to do this using ajax. 2) This could be a tricky one as what happens if the user checks a box unchecks it, checks some more boxes and checks it again ? As far as I can see you have to do this client side and JS would be your best bet. Your simplest way to do it would be to have a 'value-changed' trigger that adds the ID of the select box onto a string, then send the string back with the Ajax call. Something like: HTML: Code:
<input onclick="TrackChange(this);" type="checkbox" id="test1" value=""> <input type="hidden" id="Tracker" value=""> Code:
function TrackChange(oField) {
var action ="u";
if (oField.checked) action = "c";
action = action + oField.id;
document.getElementById("Tracker").value =
document.getElementById("Tracker").value + action + ",";
}
HTH, JC |
|
|
|
|
|
#3 |
|
New Member
![]() Join Date: Feb 2009
Posts: 3
|
thank you... now I have to find a good book about AJAX and java script or maybe a good example. what about the last one?
|
|
|
|
|
|
#4 | |
|
Super Moderator
![]() Join Date: Jun 2008
Posts: 493
|
Quote:
|
|
|
|
|
|
|
#5 |
|
New Member
![]() Join Date: Feb 2009
Posts: 3
|
yes! I didn't understand anything. I should try to study javascript a little )
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|