Jump to content

Form element dynamic changes


ferdia

Recommended Posts

Hey guys. Total rookie in JScript here. I've a form, here are three of the elements:

 

<tr>
    <td width="70" valign="top"><strong>Type:</strong></td>
    <td width="204"><select name="my-item-name" size="4" id="myitemname">
        <option value="Object 1">Object 1</option>
        <option value="Object 2">Object 2</option>
        <option value="Object 3">Object 3</option>
    </select></td>
  </tr>
  <input type="hidden" name="my-item-id" value="<?php echo $row_rsOil['id']; ?>" />
  <input type="hidden" name="my-item-price" value="<?php echo $row_rsOil['price']; ?>" />
  <input type="hidden" name="my-item-url" value="tramore-oil.php" /> 
  <tr>
    <td><strong>Quantity:</strong></td>
    <td><input name="my-item-qty" type="text" id="myitemqty" size="5" maxlength="5" /> <span id="msg">Litres</span></td>
  </tr>
  <tr>
    <td><strong>OR Value:</strong></td>
    <td>€<input name="my-item-value" type="text" id="myitemvalue" size="5" maxlength="5" /></td>
  </tr>

 

Basically what I need is this. When someone selects an object in the select box. I need "Quantity" and "Value" to prepopulate, and change if a different object is selected.

 

There is a second task the JScript has to handle though. Value is a multiple of Quantity. If someone updates one, I need the other to change too.

 

Advice would be greatly appreciated :)

Link to comment
https://forums.phpfreaks.com/topic/232604-form-element-dynamic-changes/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.