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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:15:13+00:00 2026-05-24T11:15:13+00:00

I was using a condition onsubmit to return false if the text field didn’t

  • 0

I was using a condition onsubmit to return false if the text field didn’t have more than 10 characters however it stopped submitting at all just now, I don’t think I changed anything less the condition but obviously I must have done something.

<form class="form-new" action="insert/insert.php" method="post" onsubmit="if (document.getElementById('post-input').value.length < 10) return false;">
    <textarea class="form-new" id="post-input" name="text"></textarea><br/>
    <input type="hidden" name="ciudad" value="<?=$city;?>">
    <input type="text" name="colegio" value="<?=$group;?>">
    <input class="form-new" type="submit" value="Publicar"/>
</form>

Is there a way round? Or am I just doing it wrong? Thanks

  • 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-24T11:15:14+00:00Added an answer on May 24, 2026 at 11:15 am

    Here is your example.

    But have a look, if you return false in onsubmit the form will be sent anyway. In order to perform alert or something like that, you should do something like this:

    <script type="text/javascript">
        function checkLength() {
            var textarea=document.getElementById('post-input');
        alert(textarea.value.length >= 10);
            if (textarea.value.length >= 10) {
                document.getElementById('myform').submit();
            }
        }
    </script>
    
    <form class="form-new" action="insert/insert.php" id="myform" method="post">
        <textarea class="form-new" id="post-input" name="text"></textarea><br/>
        <input type="hidden" name="ciudad" value="<?=$city;?>">
        <input type="text" name="colegio" value="<?=$group;?>">
        <input class="form-new" type="button" value="Publicar" onclick="checkLength()"/>
    </form>
    

    and this is the link: http://jsfiddle.net/YNcU4/1/.

    UPDATE: Please read comments. The original code should work.

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

Sidebar

Related Questions

I have got a strange compile error while using condition operator. a,b are int
I have a problem with Loop through a using the condition that an attribute
In my search module I am using SQLite database. Sometimes I'm searching more than
I'm using condition variables in threads that require a timeout. I didn't notice until
I have the following condition using in my code but that doesn't look very
I have a Rails named_scope which is using a condition to pull specific days
I am using this condition as part of my where clause: exists (select *
Suppose I let the user to write a condition using Javascript, the user can
Would it be possible to print Hello twice using single condition ? if condition
Are there any race condition issues when using NSNotifications within a single thread? Here

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.