dialog box and radio input values
dialog box and radio input values
pearly_030
Posts: 42Questions: 0Answers: 0
Hi,
In a modal dialog form I don't know how to get back radio input values.
In my example, document.getElementById("choix").value always returns "0" and never "1".
[code]
$('#mesreservations tbody tr').live('click',function(){
var vData3 = oTable3.fnGetData(this);
$( "#dialog:ui-dialog" ).dialog( "destroy" );
var choix=25;
$('#dialog-form').load('form_reservations.php?id_reservation='+vData3[0]+'&id_vehicule='+vData3[1]+'&passagers='+vData3[10]).dialog({
autoOpen: true,
title: 'Mes réservations',
height: 250,
width: 470,
modal: true,
position: ['center',75],
buttons: {
'Annuler': function()
{
$(this).dialog('close');
},
'OK':function() {
alert(document.getElementById("passagers").value);
alert(document.getElementById("choix").value);
}
}
});
});
[/code]
form_reservation.php :
[code]
Je souhaite annuler cette réservation.
Je souhaite modifier le nombre de passagers.
<?php
for ($i = 1; $i <= $passagers_maximum ; $i++) {
if ($i == $passagers) {
echo ''.$passagers.'';
}else{
echo ''.$i.'';
}
}
?>
[/code]
Idea?
Thanks.
In a modal dialog form I don't know how to get back radio input values.
In my example, document.getElementById("choix").value always returns "0" and never "1".
[code]
$('#mesreservations tbody tr').live('click',function(){
var vData3 = oTable3.fnGetData(this);
$( "#dialog:ui-dialog" ).dialog( "destroy" );
var choix=25;
$('#dialog-form').load('form_reservations.php?id_reservation='+vData3[0]+'&id_vehicule='+vData3[1]+'&passagers='+vData3[10]).dialog({
autoOpen: true,
title: 'Mes réservations',
height: 250,
width: 470,
modal: true,
position: ['center',75],
buttons: {
'Annuler': function()
{
$(this).dialog('close');
},
'OK':function() {
alert(document.getElementById("passagers").value);
alert(document.getElementById("choix").value);
}
}
});
});
[/code]
form_reservation.php :
[code]
Je souhaite annuler cette réservation.
Je souhaite modifier le nombre de passagers.
<?php
for ($i = 1; $i <= $passagers_maximum ; $i++) {
if ($i == $passagers) {
echo ''.$passagers.'';
}else{
echo ''.$i.'';
}
}
?>
[/code]
Idea?
Thanks.
This discussion has been closed.
Replies
[code]
$('#choix').val();
[/code]
Normally with radio buttons you have more than one and you get the value of the one selected using something like
[code]
$('input:radio[name=choix]:checked').val()
[/code]
I'm just guessing here, but are you sure it's not a checkbox you want?
I found this solution
$('input[name=choix]:checked').val()
Many Thanks for your help.