Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Validation Script Only Works in IE, Not Mozilla

Guest
Aug 29, 2006 Aug 29, 2006
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?
TOPICS
Server side applications
249
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Aug 23, 2007 Aug 23, 2007
Sorry I didn't close this one out. That was the problem!! Thanks!!
Translate
LEGEND ,
Aug 30, 2006 Aug 30, 2006
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>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 23, 2007 Aug 23, 2007
LATEST
Sorry I didn't close this one out. That was the problem!! Thanks!!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines