Hi,
I have a form which is binded to a JQuery Form (AjaxForm) object.
In the form I have some radio buttons:
<input type="radio" id="dialog_stranka_dodajuredi_tip_fizicna" name="dialog_stranka_dodajuredi_tip" value="2" /> Selection 2
<input type="radio" id="dialog_stranka_dodajuredi_tip_pravna" name="dialog_stranka_dodajuredi_tip" value="1" /> Selection 1
Now, when the form gets posted via AJAX, the parameter "dialog_stranka_dodajuredi_tip" is empty. It doesn't have a value at all - regardless of which radio button is selected.
I also tried binding a change event like this:
$('input[name=dialog_stranka_dodajuredi_tip]').bind('change', function(){
switch (parseInt($('input[name=dialog_stranka_dodajuredi_tip]:checked').val())) {
case 2:
alert('number 2 selected');
break;
case 1:
alert('number 1 selected');
break;
}
});
But the val property has no value at all. The alert box doesn't pop up.
I've used firebug to debug and set watches at this point and this is the result (values):
$('input[name=dialog_stranka_dodajuredi_tip]').val() -> value: ""
$('input[name=dialog_stranka_dodajuredi_tip]:checked').attr('id') --> value: "dialog_stranka_dodajuredi_tip_pravna"
$('input[name=dialog_stranka_dodajuredi_tip]:checked').attr('name') --> value: "dialog_stranka_dodajuredi_tip"
$('input[name=dialog_stranka_dodajuredi_tip]:checked').val() --> value: ""
As you can see, the val() simply doesn't return a value, although the value is set in the tag. I'm clueless, any ideas?