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

The Archive Base Latest Questions

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

function isInteger(char) { return (char.toString().search(/^-?[0-9]+$/) == 0 ) } function validateQuan() { var minExist

  • 0
function isInteger(char) {
    return (char.toString().search(/^-?[0-9]+$/) == 0 )
}
function validateQuan() {
var minExist = "false";
    for (i=0; i<3; i++) {
        var j = document.getElementById("ProductQuantity_"+i).value; 
        if (isInteger(j) && j > 0) {minExist = "true";alert("oi");} 
    }
    if (minExist == "true") {$("#pvs_form").submit();} else {alert("Please enter at least one valid quantity");}
}

Above is my code, it’s working on FF 3.6 and IE8, but not with IE7.
At IE7 “if (isInteger(j) && j > 0)” couldn’t lead to “true”.
Even i remove “j > 0” and use “[1-9]” on regex.

Any better solution?

edit : sorry, the regex is wrong, any number > 9 is “true” too.

edit : big sorry to all, i just found that the main problem actually because i got other form at the same page with the same id “ProductQuantity_“+i, and likely it turn the IE7 to only look at the first element with that id found on page.
Maybe my original code was working actually, but thx to remind me that the regex is not as expected and to get better code. Thx and sorry once more.

  • 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-28T03:49:56+00:00Added an answer on May 28, 2026 at 3:49 am
       var isInteger = function( str ) { 
          return  (str|0) == str;
        };
    

    Bitwise OR by 0 ensure that, string or number with floating point is replaced to integer

    isInteger("3.4") // false
    isInteger("abc") // false => "abc"|0 = 0
    isInteger("3") // true
    

    And now:

    function validateQuan() {
        var minExist = false ;
        for (var i = 0; i < 3; i++ ){
            var j = document.getElementById("ProductQuantity_"+i).value; 
            if ( isInteger( j ) && j > 0 ) {
                minExist = true; 
                alert("oi");
                break; // goal achieved, break loop
            } 
        }
        if ( minExist ) {
            $("#pvs_form").submit();
        } else {
            alert("Please enter at least one valid quantity");
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple C function as follows: unsigned char clamp(short value){ if (value
Here is a simple function that converts a string to an integer. int str2int(char
char *test = hello; test = change_test(world); printf(%s,test); char* change_test(char *n){ printf(change: %s,n); return
#include <stdio.h> #include <ctype.h> /*header for standard tolower function*/ #define STRING_LEN 500 char *
void expand_combinations(const char *remaining_string, string const & s, int rema in_depth) { if(remain_depth==0) {
I have a function to convert integer to string .The function is char *
I have defined a function called login that should return a token. The token
I'm trying to retrieve the return value of a stored procedure in SQL Server
I'm having some trouble with function return types and pointers (sorry if this a
I am trying to cast something to char(n) where n is a function argument

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.