dialog box and radio input values

dialog box and radio input values

pearly_030pearly_030 Posts: 42Questions: 0Answers: 0
edited October 2011 in General
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.

Replies

  • OmnimikeOmnimike Posts: 22Questions: 0Answers: 0
    edited October 2011
    I'm not entirely sure why it isn't working for you (I'm not too familier with using dom nodes directly). Have you tried using jquery to get the value? You would do it in jquery like this:
    [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?
  • pearly_030pearly_030 Posts: 42Questions: 0Answers: 0
    OK Omnimike,

    I found this solution
    $('input[name=choix]:checked').val()

    Many Thanks for your help.
This discussion has been closed.