Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7933143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:14:20+00:00 2026-06-03T21:14:20+00:00

I have a form that must execute a javascript function on submit, the function

  • 0

I have a form that must execute a javascript function on submit, the function then posts data to my php send mail file and the mail is sent. But it only works in fire fox. The form action does not seem to be doing anything in IE, my question is: Is this the correct way to call a function from an external file from the form action:

action="javascript:simpleCart.checkout()"

simpleCart is the .js file and checkout() is the function.

Tips appreciated, struggling to understand why it would work in firefox but not IE, chrome or safari.

<form name=form onsubmit="return validateFormOnSubmit(this)" enctype="multipart/form-data" action="javascript:simpleCart.checkout()" method="post">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:14:21+00:00Added an answer on June 3, 2026 at 9:14 pm

    A form action set to a JavaScript function is not widely supported, I’m surprised it works in FireFox.

    The best is to just set form action to your PHP script; if you need to do anything before submission you can just add to onsubmit

    Edit turned out you didn’t need any extra function, just a small change here:

    function validateFormOnSubmit(theForm) {
        var reason = "";
        reason += validateName(theForm.name);
        reason += validatePhone(theForm.phone);
        reason += validateEmail(theForm.emaile);
    
        if (reason != "") {
            alert("Some fields need correction:\n" + reason);
        } else {
            simpleCart.checkout();
        }
        return false;
    }
    

    Then in your form:

    <form action="#" onsubmit="return validateFormOnSubmit(this);">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that posts some data to a PHP processing script. I
If have a html form like <form method=POST action=http://.../file.php> <input type=text name=data id=data />
I have a data entry form that anybody must fill up 3 forms. I
I have a form that when my users click submit, I first want to
I have a form that i want to submit comments to a database containing
I have a form that uses jQuery to submit an ajax post and it
I have created a form that must pass validation via JQuery to see if
I have a listener that returns a TcpClient that must read data until the
I have a form that performs calculations live as the user enters data. However,
I have a form that will accept and save a MP4 video file. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.