0

hi am new to jsp
i hav a situation
i hav a listbox
it contains 4 values [s,a,r,d]
the moment s value is selected from the list 4 fields will be unlocked

what i want is
i want the listbox to display only one value[s] if the 4 fields which are unlocked are not filled in by the user

if he has filled in all the 4 fields then all the 4 values of the listbox should be displayed

how can i achieve this

thanks in adv

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by javaAddict
0

You can do that with javascript.
Example, add an onchange event at the select tag. When you change something make the fields editable. Then take the values of those fields and check them if they are filled. You can use javascript to change the content of the select box.

For the fields, you can add an onkey... event so when the user types something at the field you will check the same.:
http://www.w3schools.com/
Read the javascript tutorial and the DOM tutorial

<head>
  <script>
    function callFunction() {
       var v = document.getElementById("field").value;
    }
  </script>
</head>
<body>

  <input type="text" id="field" name="field" value="" onkeyup="callFunction2();" />
  
  <select onchage="callFunction();" id="select_id" name="some_name">
</body>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.