Depending on how your serverside processing works it makes sense that
it would process both. Doesn't disable just prevent a client-side user
from changing the checkbox? Make when the user check the check you can
add or remove the desired checkbox using: 
http://docs.jquery.com/Manipulation/remove#expr.
Otherwise wouldnt it make more sense to have your form processing
script evaluate the checkbox and decide whether or not something gets
posted? To have that sort of control through JQuery you may have to
look at using Ajax to do a $.post

On Jul 10, 2:44 pm, Matt Zagrabelny <mzagr...@d.umn.edu> wrote:
> On Fri, 2009-07-10 at 14:40 -0700, Matthew wrote:
> > Can you explain to me why you are disabling a hidden input field? I
> > assume the idea is that they are both checkboxes with the the same
> > name attribute. Maybe I could help if I understood why you are doing
> > this.
>
> The form handler on the server side processes both if the checkbox is
> checked. I only want one to be processed.
>
> Regardless, both blocks are being executed... (crazy)
>
> Thanks,
>
>
>
> > On Jul 10, 1:38 pm, Matt Zagrabelny <mzagr...@d.umn.edu> wrote:
> > > Greetings,
>
> > > I am experiencing some crazy stuff, at least crazy to me...
>
> > > Both the 'if' and 'else' blocks (according to firebug) are being
> > > executed in the following anonymous function:
>
> > > <html>
> > > <head>
> > > <script language="javascript" type="text/javascript"
> > > src="/usr/share/javascript/jquery/jquery.js"></script>
> > > <script language="javascript" type="text/javascript">
> > > $(function() {
> > >   add_billable_oncheck();
>
> > > });
>
> > > function add_billable_oncheck() {
> > >   var billable_hidden   = $('#billable_hidden')[0];
> > >   var billable_checkbox = $('#billable_checkbox')[0];
> > >   if ((billable_hidden   != null) &&
> > >       (billable_checkbox != null)) {
> > >     $(billable_checkbox).change(
> > >       function(event) {
>
> > > // These are the blocks that both get executed on checkbox check
> > >         if (billable_checkbox.checked) {
> > >           billable_hidden.disabled = true;
> > >         } else {
> > >           billable_hidden.disabled = false;
> > >         }
> > > // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> > >       }
> > >     );
> > >   }}
>
> > > </script>
> > > </head>
> > > <body>
> > > <form>
> > >   <input id="billable_hidden" type="hidden" name="billable"
> > > value="No" />
> > >   <input id="billable_checkbox" type="checkbox" name="billable"
> > > value="Yes" />
> > > </form>
> > > </body>
> > > </html>
>
> > > Does anyone have any insight into this one?
>
> > > If I add 'return;' statements at the end of the blocks, things work as
> > > expected, however I wouldn't expect that I should have to do that.
>
> > > Thanks for the help,
>
> > > --
> > > Matt Zagrabelny - mzagr...@d.umn.edu - (218) 726 8844
> > > University of Minnesota Duluth
> > > Information Technology Systems & Services
> > > PGP key 1024D/84E22DA2 2005-11-07
> > > Fingerprint: 78F9 18B3 EF58 56F5 FC85  C5CA 53E7 887F 84E2 2DA2
>
> > > He is not a fool who gives up what he cannot keep to gain what he cannot
> > > lose.
> > > -Jim Elliot
>
> > >  signature.asc
> > > < 1KViewDownload
>
> --
> Matt Zagrabelny - mzagr...@d.umn.edu - (218) 726 8844
> University of Minnesota Duluth
> Information Technology Systems & Services
> PGP key 1024D/84E22DA2 2005-11-07
> Fingerprint: 78F9 18B3 EF58 56F5 FC85  C5CA 53E7 887F 84E2 2DA2
>
> He is not a fool who gives up what he cannot keep to gain what he cannot
> lose.
> -Jim Elliot
>
>  signature.asc
> < 1KViewDownload

Reply via email to