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