www.webdeveloper.com
Results 1 to 2 of 2

Thread: jquery repeat it self in every repeated field

  1. #1
    Join Date
    Jan 2014
    Posts
    1

    Angry jquery repeat it self in every repeated field

    i making a drug storage inventory im using jquery to search for items to insert its quantity , when i repeat every item fields and search for second item and choose it from list , it changes the previews item to the same one like the second one i choose .

    here is an example

    PHP Code:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript">
    function lookup(inputString) {
        if(inputString.length == 0) {
            // Hide the suggestion box.
            $('#suggestions').hide();
        } else {
            $.post("rpc3.php", {queryString: ""+inputString+""},
     function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    } // lookup
    function fzl(thisValue) {
        $('.inputString').val(thisValue);
        setTimeout("$('#suggestions').hide();", 200);
    }
    function fzlz(thisValue) {
        $('.inputStringz').val(thisValue);
    }

    function fzlzo(thisValue) {
        $('.inputStringzo').val(thisValue);
    }
    </script>


                 <form action="send.php" method="post" name="theform" onsubmit="return formCheck(this);" autocomplete='off'>

    <table>

       <tr>

        <td><label>name</label></td>

                    <td><input style="text-align: right" type="text" size="30" value="" class="inputString" onkeyup="lookup(this.value);" onblur="fzl();" name="drug" />
             <div class="suggestionsBox" id="suggestions" style="display: none; z-index:10; position: absolute;">

                <div class="suggestionList" id="autoSuggestionsList" lang="ar">
                    &nbsp;
                </div>
            </div></td>

           <td><label>code</label></td>


          <td><input style="text-align: right" type="text" size="30" value="" class="inputStringz"  onkeyup="lookup(this.value);" onblur="fzlz();" name="code" /></td>

          <td><label>unit</label></td>

           <td><input style="text-align: right" type="text" size="30" value="" class="inputStringzo"  onkeyup="lookup(this.value);" onblur="fzlzo();" name="unit" /></td>            

            </tr>

            <tr>

        <td><label>name</label></td>

                    <td><input style="text-align: right" type="text" size="30" value="" class="inputString" onkeyup="lookup(this.value);" onblur="fzl();" name="drug" />
             <div class="suggestionsBox" id="suggestions" style="display: none; z-index:10; position: absolute;">

                <div class="suggestionList" id="autoSuggestionsList" lang="ar">
                    &nbsp;
                </div>
            </div></td>

           <td><label>code</label></td>


          <td><input style="text-align: right" type="text" size="30" value="" class="inputStringz"  onkeyup="lookup(this.value);" onblur="fzlz();" name="code" /></td>

          <td><label>unit</label></td>

           <td><input style="text-align: right" type="text" size="30" value="" class="inputStringzo"  onkeyup="lookup(this.value);" onblur="fzlzo();" name="unit" /></td>            

            </tr>

    </table>
    </form> 
    and this is the php file (rpc3.php)


    PHP Code:

    <?php

    include 'config.php';
    if(isset(
    $_POST['queryString'])) {
            
    $queryString $_POST['queryString'];
            if(
    mb_strlen($queryString) > 1) {
    $selc "SELECT * FROM `drug_info` WHERE `dru_name` LIKE '%$queryString%' LIMIT 10";
    $result mysql_query ($selc);
    while (
    $row mysql_fetch_array ($result))
    {
        
    $code $row ["dru_code"];
        
    $name $row ["dru_name"];
        
    $unit $row ["dru_unit"];
        
    $barcode $row ["dru_barcode"];
        echo (
    '<li onClick="fzl(\''.$name .'\');fzlz(\''.$code .'\');fzlzo(\''.$unit .'\');fzlzb(\''.$barcode .'\')">' $name '</li>');
    }
            }
    }

    ?>

    i need to repeat it more about 10 times ... any help please for dis problem

  2. #2
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,506
    Why is this question in Javascript when it should be in the Javascript Frameworks forums?
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles