Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2014
    Thanked 0 Times in 0 Posts

    Angry how to manipulate multi repeated fields with jquery autocompelete

    i found this is the best place to post my problem , i hope you can help me so please be patient with me

    first im making a drug inventory i make a page for insertion of drug quantity for every item , i dunt need to insert every item separately i want to insert it all at once , i fount jquery ui autocompelete to search for every item name , and used field repeater to repeat fields necessary for every item , the main probelm when i use it for the first item it works good , but when i add another item , it manipulate the same result to the previews item i will explain it now ... im searching over the web from 8 days until now and find nothing ... if any one can solve it or have another script to do the same thing please tell me .

    this screen shoots

    this when i use jquery for one item to manipulate other fields it works great.

    and this when i try to use multi items it repeat results to previews rows.

    this my codes

    PHP Code:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Untitled Document</title>

    <body dir="rtl">

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
     <script type="text/javascript">
        function lookup(inputString) {
            if(inputString.length == 0) {
                // Hide the suggestion box.
            } else {
                $.post("../modules/rpc3.php", {queryString: ""+inputString+""}, function(data){
                    if(data.length >0) {
        } // lookup
        function fzl(thisValue) {
            setTimeout("$('#suggestions').hide();", 200);
        function fzlz(thisValue) {
        function fzlzo(thisValue) {
        function fzlzb(thisValue) {

    <table cellpadding="2" cellpadding="1" border="1" width="100%" align="center">
                                    <th align="center" width="5%" bgcolor="#CCCCCC">Code</th>
                                    <th align="center" width="15%" bgcolor="#CCCCCC">Drug Name</th>
                                    <th align="center" width="10%" bgcolor="#CCCCCC">Unit</th>
                                    <th align="center" width="15%" bgcolor="#CCCCCC">Expiration Date</th>
                                    <th align="center" width="10%" bgcolor="#CCCCCC">Batch Number</th>
                                    <th align="center" width="10%" bgcolor="#CCCCCC">Quantity</th>
      <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js'></script>
     $(document).ready(function () {
         $('#addRow').click(function () {
               $('<div/>', {
                   'class' : 'extraPerson', html: GetHtml()
     function GetHtml()
        var len = $('.extraPerson').length;
        var $html = $('.extraPersonTemplate').clone();
        $html.find('[name=code[]]')[0].name="code[]" + len;
        $html.find('[name=drug[]]')[0].name="drug[]" + len;
        $html.find('[name=unit[]]')[0].name="unit[]" + len;
        $html.find('[name=dateofexp[]]')[0].name="dateofexp[]" + len;
        $html.find('[name=monthofexp[]]')[0].name="monthofexp[]" + len;
        $html.find('[name=yearofexp[]]')[0].name="yearofexp[]" + len;
        $html.find('[name=batch[]]')[0].name="batch[]" + len;
        $html.find('[name=quantity[]]')[0].name="quantity[]" + len;
        return $html.html();    

    <div class="extraPersonTemplate">
        <div class="controls controls-row">
          <table align="center" width="100%"> 
                    <input style="text-align: right" type="text" size="15" value="" class="inputStringz"  onkeyup="lookup(this.value);" onblur="fzlz();" name="code[]" />
            <td >
                 <input style="text-align: right" type="text" size="25" 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">
            <input style="text-align: right" type="text" size="15" value="" class="inputStringzo"  onkeyup="lookup(this.value);" onblur="fzlzo();" name="unit[]" />
              <td>   <div align="right">
            <select name="dateofexp[]">
            <option value="">Day</option>
            <?php for ($i 1$i <= 31$i++) : ?>
            <option value="<?php echo ($i 10) ? '0'.$i $i?>"><?php echo $i?></option>
            <?php endfor; ?>
            <select name="monthofexp[]">
            <option value="">Month</option>
            <?php for ($i 1$i <= 12$i++) : ?>
            <option value="<?php echo ($i 10) ? '0'.$i $i?>"><?php echo $i?></option>
            <?php endfor; ?>
            <select name="yearofexp[]">
            <option value="">Year</option>
            <?php for ($i 2010$i <= 2028$i++) : ?>
            <option value="<?php echo ($i 10) ? '0'.$i $i?>"><?php echo $i?></option>
            <?php endfor; ?>
             <td><div align="right">
            <input type="text" name="batch[]" size="15">
            <td><input class="span3" type="text" name="quantity[]"></td>
    <div id="container"></div>
    <a href="#" id="addRow"><i class="icon-plus-sign icon-white"></i><h4> Add Drug</h4></p></a>
      <br><br><div align="right">
       <INPUT TYPE="submit" VALUE="Insert Quantity">   <INPUT TYPE="reset" VALUE="Clear"></div>

    and this the RPC file

    PHP Code:


    include 'config.php';
    $_POST['queryString'])) {
    $queryString $_POST['queryString'];
    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 know there is a problem in repeating the IDs in jquery auto complete and i have to use class but it doesn't work .
    please anyone can solve it or give me another scripts to do the same thing correctly .

    thanx for you all

  2. AdSlot6
  3. #2
    New to the CF scene
    Join Date
    Jan 2014
    Thanked 0 Times in 0 Posts
    is there any help ?


Posting Permissions

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