Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22577

Re: Default values of checkboxes in forms

Newsgroups comp.lang.javascript
Date 2014-01-11 23:58 -0800
References <2fae46c4-b07c-48e6-a6b4-d7cdc597225a@googlegroups.com> <26361713-4ab5-4df3-9cf4-3f293e53d2ff@googlegroups.com> <548b3877-55d8-4daa-baa6-672d4978c617@googlegroups.com>
Message-ID <a2ea0b02-d30d-48a7-9fda-a5f5d1f54501@googlegroups.com> (permalink)
Subject Re: Default values of checkboxes in forms
From jonas.thornvall@gmail.com

Show all headers | View raw


Den söndagen den 12:e januari 2014 kl. 08:43:48 UTC+1 skrev jonas.t...@gmail.com:
> Den söndagen den 12:e januari 2014 kl. 08:24:01 UTC+1 skrev jonas.t...@gmail.com:
> 
> > Den söndagen den 12:e januari 2014 kl. 08:05:47 UTC+1 skrev jonas.t...@gmail.com:
> 
> > 
> 
> > > I know this is not strictly JavaScript, but i've tried to figure out if there is boolean default values for checked unchecked sent from a form checkbox to JavaScript when value not set.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > If so what are the default values passed?
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > In code i use this statement to Catch value.
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > primen = parent.menu.document.check.p.value;
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > And in HTML
> 
> > 
> 
> > > 
> 
> > 
> 
> > > <FORM NAME=check onSubmit="parent.ulam.checked(); return false;"> 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > P<input type="checkbox" name="p" checked="yes
> 
> > 
> 
> > > 
> 
> > 
> 
> > > </FORM> 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > 
> 
> > 
> 
> > > So does primen get a value by default when "p" checked and unchecked?
> 
> > 
> 
> > 
> 
> > 
> 
> > There seem to be a thousand convoluted answers on the net to this question?
> 
> > 
> 
> > 
> 
> > 
> 
> > if ( parent.menu.document.getElementById('p').checked){
> 
> > 
> 
> > 
> 
> > 
> 
> > do something?
> 
> > 
> 
> > }
> 
> 
> 
> I attached an id to the name in form, but the code will not run.
> 
> An example of how you fetch checked/unchecked from a form?
> 
> 
> 
> Should not the below work?
> 
> 
> 
> if (parent.menu.document.check.getElementById('p').checked){
> 
>  printprime(); 
> 
> }
> 
> 
> 
> This is my form but the above code totally hang the script.
> 
> 
> 
> <FORM NAME=check onSubmit="parent.ulam.test(); return false;">
> 
> P<input id="p"  name="p" type="checkbox" checked="yes> 
> 
> </FORM>

I also tried this approach skipping the form just go for the element byte id, but it does not work.

var testar=parent.menu.document.getElementById('p');
         
         if(testar==checked) printprime();

Now code runs but i can not call printprime(); 

And also tried this if testar turn out to be string

         var testar=parent.menu.document.getElementById('p');
         if(testar=="checked") printprime();   

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-11 23:05 -0800
  Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-11 23:24 -0800
    Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-11 23:43 -0800
      Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-11 23:58 -0800
        Re: Default values of checkboxes in forms "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-12 09:40 +0100
          Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-12 01:58 -0800
            Re: Default values of checkboxes in forms "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-12 17:50 +0100
              Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-12 22:52 -0800
                Re: Default values of checkboxes in forms "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-13 11:40 +0100
                Re: Default values of checkboxes in forms Denis McMahon <denismfmcmahon@gmail.com> - 2014-01-13 13:02 +0000
                Re: Default values of checkboxes in forms "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-13 15:00 +0100
              Re: Default values of checkboxes in forms jonas.thornvall@gmail.com - 2014-01-13 01:28 -0800
                Re: Default values of checkboxes in forms "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-13 11:10 +0100
  Re: Default values of checkboxes in forms "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2014-01-12 10:37 +0200
  Re: Default values of checkboxes in forms Tim Streater <timstreater@greenbee.net> - 2014-01-12 09:25 +0000

csiph-web