By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

Show the content using dropdown options

P: 3
Expand|Select|Wrap|Line Numbers
  1. <td>Rooms :</td><td>
  2. <select name="Room1">
  3.   <option>1</option>
  4.   <option>2</option>
  5.   <option>3</option>
  6.   </select></td>

When i select room 1 from the above drop down then the below field i.e details 4 room 1 should get display...

Expand|Select|Wrap|Line Numbers
  1. <tr><td><font color="Red">*</font>Rooms Type :</td><td>
  2. <select name="Roomtype1">
  3.   <option>Double</option>
  4.   <option>Twin</option>
  5.   <option>Double plus 1 child</option>
  6.   <option>Twin plus 1 child</option>
  7. <option>Twin for sole use</option>
  8. <option>Single</option>
  9. <option>Triple</option>
  10. <option>Quadruple</option>
  11. </select></td>
  12. <td> Adults :</td><td>
  13. <select name="Adults1">
  14.   <option>1</option>
  15.   <option>2</option>
  16.   <option>3</option>
  17.   <option>4</option>
  18. <option>5</option>
  19. <option>6</option>
  20. <option>7</option>
  21. <option>8</option>
  22. <option>9</option>
  23. <option>10</option>
  24. </select></td>
  25. <td>Children :</td><td>
  26. <select name="Child1">
  27. <option>0</option>
  28.   <option>1</option>
  29.   <option>2</option>
  30.   <option>3</option>
  31.   <option>4</option>
  32. <option>5</option>
  33. <option>6</option>
  34. <option>7</option>
  35. <option>8</option>
  36. <option>9</option>
  37. <option>10</option>
  38. </select></td></tr>

and when i select 2 then details of room1 and room2 shld display...


Expand|Select|Wrap|Line Numbers
  1. <select name="Roomtype2">
  2.   <option>Double</option>
  3.   <option>Twin</option>
  4.   <option>Double plus 1 child</option>
  5.   <option>Twin plus 1 child</option>
  6. <option>Twin for sole use</option>
  7. <option>Single</option>
  8. <option>Triple</option>
  9. <option>Quadruple</option>
  10. </select></td>
  11. <td> Adults :</td><td>
  12. <select name="Adults2">
  13.   <option>1</option>
  14.   <option>2</option>
  15.   <option>3</option>
  16.   <option>4</option>
  17. <option>5</option>
  18. <option>6</option>
  19. <option>7</option>
  20. <option>8</option>
  21. <option>9</option>
  22. <option>10</option>
  23. </select></td>
  24. <td>Children :</td><td>
  25. <select name="Child2">
  26. <option>0</option>
  27.   <option>1</option>
  28.   <option>2</option>
  29.   <option>3</option>
  30.   <option>4</option>
  31. <option>5</option>
  32. <option>6</option>
  33. <option>7</option>
  34. <option>8</option>
  35. <option>9</option>
  36. <option>10</option>
  37. </select></td></tr>
And similar when i select 3....


please reply ASAP
Thanks in advance....
Jun 6 '12 #1

✓ answered by acoder

Do you mean Microsoft Access?

I've already shown how you can get the selected value. I should add that you will need to add the value property for the options for some browsers:
Expand|Select|Wrap|Line Numbers
  1. <option value="1">1</option>
There are other alternatives to get the selected value, but this is the simplest.

Share this Question
Share on Google+
3 Replies


acoder
Expert Mod 15k+
P: 16,027
The simplest way to do this is to have the dropdowns hidden initially (except perhaps the ones for room 1).

Then show the others using the onchange event, e.g.
Expand|Select|Wrap|Line Numbers
  1. <select name="Room1" onchange="call_function_here()">
Note that this is inline, but it would be better to move this out of the HTML.

To get the current selected value, you can simply get the value property, e.g.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('Room1').value;
assuming you add an ID of "Room1".

To show/hide objects, set the display property to "block"/"none" respectively.

A better method, though, is to add the options dynamically depending on the selection.
Jun 14 '12 #2

P: 3
thank u ....
Can help me in updating in acess???
and retrieving same value depending on number of room select....
Jun 17 '12 #3

acoder
Expert Mod 15k+
P: 16,027
Do you mean Microsoft Access?

I've already shown how you can get the selected value. I should add that you will need to add the value property for the options for some browsers:
Expand|Select|Wrap|Line Numbers
  1. <option value="1">1</option>
There are other alternatives to get the selected value, but this is the simplest.
Jun 20 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.