Jump to content

Please help in my code..


jjqbunty

Recommended Posts

 <script type="text/javascript">
            function qtycheck() {
              var A = "qty_'+row_id+'".value;
              var B = "qtyact_'+row_id+'".value;
             
              if (A = or > B) {
                "qty_'+row_id+'".value=0  
                alert("not allowed");
              } else {
              alert("OK");
              }
            }
        </script> 

Link to comment
Share on other sites

I want when this function called by a button onchange, number in "qty" must not be greater then the number in "qtyact" if its greater then this will show the error...

Here we have multiple rows.. 

Sorry I am just a beginner and found this Inventory Source Code from the web.. and found a missing very important validation.

Thanks in Advance..

Untitled.png

Link to comment
Share on other sites

Code with Single/First Line is working fine (below) with below code. But after modification for multiple rows... my knowledge and even google is not able to help me :):)

 

<script type="text/javascript">
            function qtycheck() {
              var l = qty_1.value;
              var h = qtyact_1.value;
              //alert("hi " + h + " lo " + l);
              if (l > h) {
                qty_1.value=0  
                alert("not allowed");
              } else {
                alert("OK");
              }
            }
        </script> 

 

Link to comment
Share on other sites

Thanks for the reply "justsomeguy" let me test..

Please comments on the second option as well...

var A = "qty_'+row_id+'".value;
              var B = "qtyact_'+row_id+'".value;

above code is fine? while I have multiple line to call.. Sorry for my bad programming knowledge :(

Link to comment
Share on other sites

No, that code probably isn't going to work like you expect.  What exactly are you trying to do there?  If you're trying to get the value of an input element, you need to use something like document.getElementById to get the element.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...