I would like to enable/disabled a 'shift','qty assigned', 'qty produceds' fields if the presence is yes/no.
here is my code. pls help me to sort out this problem
Thanks in advance
<script type="text/javascript">
function enableStates(to_enable)
{
var statesSelectObj = document.getElementById('shift[]');
var statesSelectObj1 = document.getElementById('qtyassigned[]');
var statesSelectObj2 = document.getElementById('qtyproduced[]');
if (statesSelectObj && statesSelectObj1 && statesSelectObj2)
{
if (to_enable)
{
statesSelectObj.removeAttribute('disabled');
statesSelectObj1.removeAttribute('disabled');
statesSelectObj2.removeAttribute('disabled');
The code should work. What is that php code there for? Do you have more than a single table? In this case you have more that a single id like "shift[]" and so on, which is illegal. The id must be unique on document/session.
I have assigned the counter ids to text field ids. Its working only for the first row.
How to pass these counter ids in javascript pls.
here is the code
<script type="text/javascript">
function enableStates(to_enable)
{
var statesSelectObj = document.getElementById('shift[]');
var statesSelectObj1 = document.getElementById('qtyassigned[]');
var statesSelectObj2 = document.getElementById('qtyproduced[]');
if (statesSelectObj && statesSelectObj1 && statesSelectObj2)
{
if (to_enable)
{
statesSelectObj.removeAttribute('disabled');
statesSelectObj1.removeAttribute('disabled');
statesSelectObj2.removeAttribute('disabled');
Bookmarks