Instead of payment_form.whatever, use
document.payment_form.whatever, or add
var payment_form = document.payment_form;
to the beginning of your script.
"hotdiggidydog" <webforumsuser@macromedia.com> wrote in
message
news:ed2u9b$9mv$1@forums.macromedia.com...
>I have a form that contains a drop-down list box, two
radar buttons, and a
> submit button. The buttons are assigned variables from
an access db.
> When the
> submit button is pressed the code runs through a form
field validation
> routine
> to make sure that items in both the drop-down box and
one of the radar
> buttons
> are selected prior to posting the information to another
page. The code
> is
> written in jscript and works fine in IE but not in
Mozilla. The error log
> in
> Mozilla shows that one of the variables in the
validation code is not
> being
> assigned correctly [var field1 =
payment_form.rate_type.value;]. When I
> remove
> the payment_form.rate_type.value and replace it with an
assigned value,
> the
> code then errors out on the next piece of code
containing a similar
> variable
> assignment [ if (!payment_form.pay_type[0].checked
&&
> !payment_form.pay_type[1].checked)]
>
> I don't understand why Mozilla is having problems with
this code, can you
> help?
>
>
> <script language="JavaScript"
type="text/JavaScript">
> <!--
>
> // ****validate form fields upon submitting form *****
> function validateForm() {
> var field1 = payment_form.rate_type.value;
> var redirect1 = "renewal_paypal.asp";
> var redirect2 = "renewal_check.asp";
> var url_string = "rt="+field1;
>
> if (!payment_form.pay_type[0].checked &&
> !payment_form.pay_type[1].checked)
> {alert ("Please select a payment method.");
> return false;
> }
> else
> {if (payment_form.rate_type.options[0].selected)
> {alert ("Please select a membership type.");
> return false;
> }
> else
> {if (field1=="")
> {alert ("Please select a payment type.");
> return false;
> }
> else
> {if (payment_form.pay_type[0].checked)
> {window.location=redirect1+"?"+url_string;
> return false;
> }
> else
> {if (payment_form.pay_type[1].checked)
> {window.location=redirect2+"?"+url_string;
> return false;
> }
> else
> {return true;
> }
> }
> }
> }
> }
> }
> //-->
> </script>
>