I have a problem in Java script when inputting data in html table via selecting from combo box.So any one can solve my problem,please send me code in Java script for restrict repeated data when the period of input.

Thank u

Recommended Answers

All 2 Replies

Since i don't have any reference on your code! Then i wil just play a simple example on disabling the list, if you picked them once.

<html>
<head>
<title> <!-- Sample --> </title>
<script type="text/javascript">
<!--
var x = 0;
function a( thisIndex )
{ x = x;  
if ( x >= 0 ) { form1.select.options[thisIndex].disabled = true; form1.select.options[thisIndex].text = 'disabled'; } x++;
var option = form1.select.options;
if ( option[0].disabled && option[1].disabled && option[2].disabled ) {  form1.select.disabled = true; 
 } 
}
document.onchange = function( e ) 
{ e = e ? e : window.event;
  t = e.relatedTarget || e.target ? e.srcElement : e.fromElement; 
if (( t.name ) && ( t.name == 'select' )) { switch( t.selectedIndex ) {
case 0 : a(0); break;
case 1 : a(1); break;
case 2 : a(2); break;
  }
}
}

//-->
</script>
</head> 
<body>
<form name="form1">
<select name="select" size="1">
<option value="">Option 1</option>
<option value="">Option 2</option>
<option value="">Option 3</option>
</select>
</form>
</body>
</html>

Hi

Thank you Very much for your reply.I am already solve this with Java script function.In that function i will just perform a if condition with in the for loop.break it when repetition is occurred with in for loop.Any way thank you very much for this. May i know who u are

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.