[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 226
  • Last Modified:

relations between form fields

hi

i created a simple form in an html page. now i was asked to do that when the user select a product the right price will appear in the price field. how and can i do it in dreamweaver?


best regards

ron
0
derrida
Asked:
derrida
  • 3
  • 2
1 Solution
 
Ryan ChongCommented:
something like this?

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="">
  <p>
    <select name="product" id="product" onChange="document.getElementById('price').innerHTML = this.value; ">
      <option value=" "></option>
      <option value="10.00">Product 1</option>
      <option value="5.88">Product 2</option>
      <option value="6.99">Product 3</option>
      <option value="11.50">Product 4</option>
    </select>
  </p>
  Price: <span id="price"></span>
  <p>&nbsp;</p>
</form>
</body>
</html>



hope this helps
0
 
RineauCommented:
Could you be more specific?

For example if you have images representing your products and you have a textfield to show the products price, you can add normal behaviours to the product images.

1) Select the appropriate image
2) Go to "Behaviours" panel and select "Set Text"
3) Then select "Set text of text field" and select the text field you want the price to appear in and type the price in the dialog box
4) Change the action to whatever you want. E.g. "onMouseOver" and there you are...


0
 
derridaAuthor Commented:
hi
thanks for your answers.
i have the products in a jump menu. then when the user will choose one product i want the price of that product to appear in the price textfield.

i hope this specification will help.

the first response is pretty close i will work on the basis of it. but i will be thankfull for more answers.


best regards

ron
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
Ryan ChongCommented:
if Price is a text field, you can try this instead:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="">
  <p>
    <select name="product" id="product" onChange="document.forms[0].price.value = this.value; ">
      <option value=" "></option>
      <option value="10.00">Product 1</option>
      <option value="5.88">Product 2</option>
      <option value="6.99">Product 3</option>
      <option value="11.50">Product 4</option>
    </select>
  </p>
  Price:
  <input name="price" type="text" id="price">
  </span>
  <p>&nbsp;</p>
</form>
</body>
</html>
0
 
derridaAuthor Commented:
hi

thanks it works perfectly . you are a life saver:)



ron
0
 
Ryan ChongCommented:
Glad could make helps here, cheers
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now