Jump to content
jjqbunty

Please help in my code..

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> 

Share this post


Link to post
Share on other sites

What issues are you having with this code?

Share this post


Link to post
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

Share this post


Link to post
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> 

 

Share this post


Link to post
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 :(

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...