Hay - - - -- (straw) = - -- ---

OK, I admit: JS doesn't seem make much sense to me. Simple things  
(evaluating some "IF's" with some AND's and OR's thrown in for fun)  
don't seem to work. I am doing some client-side validation just to  
try to "get over it." So far, not so much.

I have a little, simple JS routine which validates a form. So far, so  
good. (Just evaluating whether the user filled in the right  
combinations of stuff, code below).

Now I have a date I want to evaluate. In my "play" sample, a Credit  
Card expiration month/year which needs to be after "now." I can't yet  
evaluate this, as the simple attempt to create a date object causes  
the script to fail. (By that I mean, the script no longer works. When  
I invoke the frmChk() function, It doesn't execute the "alert(msg)"  
line under any circumstances. Nothing else changes but the enabling  
of that line noted in the script. Works fine with the line disabled.)

Tested in ff2 and ie6.

To wit:

------------------------------
<script type="text/javascript">
<!--
        function frmChk() {

                var msg = "";
                var chk_value = "";
                /* THE LINE BELOW, when enabled, causes the working script to 
fail. */
                /*var donow =  new date ();*/   

                if (document.form_general.rb_payment[0].checked == true) {
                         if (document.form_general.cc_number.value == "") {
                                msg = "We need your Credit Card number!";
                        }
                }

                if (document.form_general.rb_payment[1].checked == true) {
                        chk_value = document.form_general.po_number.value 
+document.form_general.supername.value;
                        if (chk_value == "") {
                                msg = "We need your PO or Supervisor name and 
number";
                        } else if  (
                                document.form_general.superphone.value == "" ||
                                document.form_general.supername.value=="")
                                {
                                msg = "We require your both your Supervisor's 
name and number";
                        }
                }
                alert(msg);
        }
//-->

</script>
-------------------------------------------

????

What ain't I getting? The code is directly from books and web sites....

Ken


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to