[thelist] Javascript validation help....HELP!! (Solved, thanks Matt Warden)

Michael Pack michaelpack at wvdhhr.org
Thu Aug 17 11:25:57 CDT 2006


The variable scope was the problem, I made it global and it works
perfect! That was a tough lesson I'll never forget. Thanks so much!

>>> mwarden at gmail.com 8/17/2006 11:14:30 AM >>>
On 8/17/06, Michael Pack <michaelpack at wvdhhr.org> wrote:
> function get_Children_value()
> {
> for (var i=0; i < document.sfcp_inquiry.Children.length; i++)
>   {
>   if (document.sfcp_inquiry.Children[i].checked)
>      {
>      var Children_val = document.sfcp_inquiry.Children[i].value;
>      }
>   }
> }

Children_val is a local variable, scoped only within your if
conditional. Declare it outside the block. Also, you have some logic
issues, but I can't fix them because I'm not sure exactly what you're
trying to do.

You want an alert when:
(a) any of the checkboxes is yes and no age group is checked?
(b) a checkbox and its matching age group is not checked?
(c) something else?

-- 
Matt Warden
Cleveland, OH, USA
http://mattwarden.com 


This email proudly and graciously contributes to entropy.
-- 

* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/ 

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 



More information about the thelist mailing list