views:

42

answers:

1

I must be losing my mind...

I have a form with some radio buttons, but no matter what, the POST is only including the NAME of the radios, not the value of whichever is selected:

   <input type="radio"  name="storage" value="1" id="ds_d">
   <input type="radio"  name="storage" value="2" id="ds_p">
   <input checked type="radio"  name="storage" value="3" id="ds_n">

With the 2nd radio selected (val 2; ds_p), and submited, this is the var_dump:

["storage"]=>  string(1) "0" 

in fact, it is that exact same var_dump no matter which is checked.

WTH is going on?

thx.

ps, the form is loaded into another div via jquery, if that matters.


edit: it appears to be something with the ajax. this is the code that loads the form:

$.get('/page/init/', function(data){
    $("#form_txt").html(data);
});

edit 2: just to be clear: it behaves the same whether I submit via a "submit" button, or if I submit it through ajax serialize().

A: 

the problem was that I had a jQuery function that cleared out textboxes etc. on focus, and it was calling all inputs, e.g.

$('input').focus(function(){
    $(this).val('');
});

so I had to tell it not to blank the val of the radios:

$('input:not(:radio)').focus(function(){
    $(this).val('');
});

tricky little bugger.

Thanks for the help....

stormdrain