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 6675321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:50:28+00:00 2026-05-26T03:50:28+00:00

I am designin a shoutbox which is AJAX based. http://businessgame.be/shoutbox.php The script works perfectly

  • 0

I am designin a shoutbox which is AJAX based.
http://businessgame.be/shoutbox.php

The script works perfectly in google chrome, but other browsers don’t act like I expect.

To shout a new message, there is a form which owns a input text field. When pressing enter, the form is being submitted, so I have omitted a submit button since pressing enter is sufficient.

<form method="POST" action="" onsubmit="javascript: return shout();" enctype="multipart/form-data">
<input type="text" style="width: 100%;" name="txtShout" id="txtShout" maxlength="600" autocomplete="off" title="Shout!" placeholder="Shout!">
</form>

The shout function looks like this:

function shout() {
alert("test");
        // Post shout and clear textField
        if(getLength("txtShout")) {
            AjaxUpdate("./includes/shout.php?message=" + getItemValue("txtShout"), refreshShoutBox);
            setItemValue("txtShout", "");
        }

        // Stop submit
        return false;
    }

Normally, the script should call the shout function, the AJAX would send a request to add the shout and then return false so the form does not get submitted.

But in all browsers except Google Chrome, the form gets submitted anyway. I put in an alert() in the function to check if it was called or a coding mistake but the alert is not being shown.

  • 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-05-26T03:50:29+00:00Added an answer on May 26, 2026 at 3:50 am

    Well, for some reason, I couldn’t get the onsubmit function working in other browsers. Instead of desperately keep looking to fix it a decided to go for a different approach. Now I just added a listener to the text box to check when a key is pressed if it was the enter key and then call that function.

    That seemed to work, still had to remove the form though, because otherwise it would get submitted ^^.

    So now I got something like this:

    function shoutEnterListener() {
        // Get object
        var domObject = document.getElementById("txtShout");
    
        // Get shoutbox html code
        if(domObject) {
            domObject.onkeydown = shoutEnter;
            domObject.onkeypress = shoutEnter;
        }
    }
    
    function shoutEnter(e) {
        var keyCode;
    
        // Check which key has been pressed
        if (window.event) {
            keyCode = window.event.keyCode;
        } else {
            keyCode = e.which;
        }
    
        // If enter, shout!
        if (keyCode == 13) {
            shout();
        }
    }
    

    The shoutEnterListener() is called in the init function. This also proves that there wasn’t a coding error whatsoever but purely the function not being called at all.

    If you still find the solution to the previous problem, let me know, because this is a bit tedious and intensive code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am designin a new table which has an identity column with int type.The
Designing forms has always been fun, but getting them to send email on the
for designing purposes i need to truncate all DB which has lots of FK's.
When designing a new J2EE based enterprise framework, do I have to prepare for
When designing an SQL query, which is faster, selecting the whole row (select *)
Im designing a dictionary App, which is having a database of minimum 220,000 entries.
Im designing a dialerPad form using Windows form, there is a textbox which should
I'm designin a pub/sub architecture using ZMQ. I need maximum reliability and scalability and
I'm designin an application in Android that connects the mobile to a bluetooth device.
Designing AIR application which has to have server side push or notification, don't know

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.