Jump to content

[SOLVED] Java to dynamically update form


Alith7

Recommended Posts

I have a quoting database system that my boss would like to dynamically populate the fields for new quotes when you select the customer from a dropdown list.

The customer DB has all the info, and I would have pulled the full DB when the page loaded.  I just need a piece of script to take cust_ID and pull the info when selected and insert it into the appropriate fields.  I can figure out the script for most of it, just not sure even where to start to pull the specific data.

 

Here is the coding that I have right now:

<td width="200" height="25"><div align="right">
          <h2>Customer:</h2>
        </div></td>
        <td><select name="cust_id" id="cust_id">
          <?php do { ?>
          <option value="<?php echo $row_listCustomer['cust_id']?>"><?php echo $row_listCustomer['name']?></option>
          <?php
} while ($row_listCustomer = mysql_fetch_assoc($listCustomer));
  $rows = mysql_num_rows($listCustomer);
  if($rows > 0) {
      mysql_data_seek($listCustomer, 0);
  $row_listCustomer = mysql_fetch_assoc($listCustomer);
  }
?>
        </select>
</td>
      </tr>
       <tr>
        <td width="200" height="25"><div align="right">
          <h2>Quoted to:</h2>
        </div></td>
        <td><input name="quote_to" type="text" class="widebox" id="quote_to" maxlength="50" /></td>
      </tr>
  <tr>
        <td width="200" height="25"><div align="right">
          <h2>Email to:</h2>
        </div></td>
        <td><input name="email_to" type="text" class="widebox" id="email_to" /></td>
      </tr>

Link to comment
Share on other sites

if it is only, like a small amount of data that you would need to access; you could use php to dynamically create a javascript array and then create a javascript function to insert data from the array into your text fields accordingly. otherwise; if your accessing a pile of data, at one time; i would skip the array idea and go straight for ajax.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.