For starters, give each of your dealAmount[] inputs an ID according to
the "Posting" index. Something like "deal_amount_1", "deal_amount_2",
etc.

Next, do the same for the inc-current TDs. Give each an ID like,
"whatever_1", "whatever_2", etc.

Grab all of the inputs using $('.deal-post') and apply your routine to
them. In that routine, parse out the index from each of the IDs in
order to arrive at your target. TD.

For the actual copying of the text from input to TD, have a look at
any of the various autocomplete plugins to see how that's done.

On Sat, Mar 7, 2009 at 1:41 AM, Eric Gun <gunawan.e...@gmail.com> wrote:
>
> Hi guys, let's get straight to the problem.
>
> First, I have this "deal-post" table (actually <tbody> content is
> generated dynamically from PHP code, but I omitted it here and make it
> static for simplicity sake):
>
> <table width="500px" id="deal-post" border="1">
>        <thead>
>                <tr valign="top" class="column-header">
>                        <th width="35%">Posting</th>
>                        <th width="25%">Description</th>
>                        <th width="30%">Amount (Rp.)</th>
>                        <th width="10%">(%)</th>
>                </tr>
>        </thead>
>        <tbody>
>                <tr valign="top" class="even">
>                        <td>Posting 1<input type="hidden" value="10" 
> name="hidPostCompId[]"/
>></td>
>                        <td align="center" style="padding: 0pt 3px;">
>                                <input type="text" class="table-textbox" 
> name="dealDesc[]"/>
>                        </td>
>                        <td align="center" class="post-amount" style="padding: 
> 0pt 3px;">
>                                <input type="text" class="table-numericbox 
> deal-post"
> name="dealAmount[]"/>
>                        </td>
>                        <td align="right" class="post-percent"></td>
>                </tr>
>                <tr valign="top" class="odd">
>                        <td>Posting 2<input type="hidden" value="3" 
> name="hidPostCompId[]"/
>></td>
>                        <td align="center" style="padding: 0pt 3px;">
>                                <input type="text" class="table-textbox" 
> value="" name="dealDesc
> []"/>
>                        </td>
>                        <td align="center" class="post-amount" style="padding: 
> 0pt 3px;">
>                                <input type="text" class="table-numericbox 
> deal-post" value=""
> name="dealAmount[]"/>
>                        </td>
>                        <td align="right" class="post-percent"></td>
>                </tr>
>                <tr valign="top" class="even">
>                        <td>Posting 3<input type="hidden" value="4" 
> name="hidPostCompId[]"/
>></td>
>                        <td align="center" style="padding: 0pt 3px;">
>                                <input type="text" class="table-textbox" 
> value="" name="dealDesc
> []"/>
>                        </td>
>                        <td align="center" class="post-amount" style="padding: 
> 0pt 3px;">
>                                <input type="text" class="table-numericbox 
> deal-post" value=""
> name="dealAmount[]"/>
>                        </td>
>                        <td align="right" class="post-percent"></td>
>                </tr>
>                <tr valign="top" class="odd">
>                        <td>Posting 4<input type="hidden" value="8" 
> name="hidPostCompId[]"/
>></td>
>                        <td align="center" style="padding: 0pt 3px;">
>                                <input type="text" class="table-textbox" 
> value="" name="dealDesc
> []"/>
>                        </td>
>                        <td align="center" class="post-amount" style="padding: 
> 0pt 3px;">
>                                <input type="text" class="table-numericbox 
> deal-post" value=""
> name="dealAmount[]"/>
>                        </td>
>                        <td align="right" class="post-percent"></td>
>                </tr>
>        </tbody>
>        <tfoot>
>                <tr>
>                        <td></td>
>                        <td align="right">Sell Price :</td>
>                        <td align="right" class="post-sell-price"></td>
>                        <td></td>
>                </tr>
>        </tfoot>
> </table>
>
>
> I want to copy the textbox-value in [Amount] column (i give the <td />
> a class name="post-amount") to respective index in [Current] column (i
> give the <td /> a class name="inc-current") as in "deal-summary" table
> below:
>
> <table width="500px" id="deal-summary" border="1">
>        <thead>
>                <tr valign="top" class="column-header">
>                        <th width="40%">Posting</th>
>                        <th width="30%">Total</th>
>                        <th width="30%">Current</th>
>                </tr>
>        </thead>
>        <tbody>
>                <tr valign="top" class="even">
>                        <td>Posting 1</td>
>                        <td align="right" class="inc-total"></td>
>                        <td align="right" class="inc-current"></td>
>                </tr>
>                <tr valign="top" class="odd">
>                        <td>Posting 2</td>
>                        <td align="right" class="inc-total"></td>
>                        <td align="right" class="inc-current"></td>
>                </tr>
>                <tr valign="top" class="even">
>                        <td>Posting 3</td>
>                        <td align="right" class="inc-total"></td>
>                        <td align="right" class="inc-current"></td>
>                </tr>
>                <tr valign="top" class="odd">
>                        <td>Posting 4</td>
>                        <td align="right" class="inc-total"></td>
>                        <td align="right" class="inc-current"></td>
>                </tr>
>        </tbody>
>        <tfoot>
>                <tr>
>                        <td align="right">Sell Price :</td>
>                        <td align="right" class="inc-sell-price"></td>
>                        <td align="right" class="inc-total-current"></td>
>                </tr>
>        </tfoot>
> </table>
>
>
> It should work like this: when I type the numeric-amount in "dealAmount
> []" textbox, the value will be showing up instantly in "inc-current"
> column in "deal-summary" table in the same row index with "deal-post"
> table.
>
> I am so desperate that I have been looking around across the internet,
> including this forum, but I just can't get the idea.
> Any help for me will be very appreciated.
>
> Thanks!
>
>
> Regards,
>
>

Reply via email to