473,396 Members | 1,996 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to enable/disable form elements by selecting check boxes from an array

I am building up a table in php built from an array in a database. I can assign each row its own id's etc. But I need to enable or disable checkbox buttons and a text area depending on the checkbox for that row being checked or not.

hotellist.php
Expand|Select|Wrap|Line Numbers
  1. <div align="center"><input type="checkbox" name="en1" id="en1" onclick="enable1(this.checked)">
  2. <input type="hidden" name="editid" id="editid" value="<?php echo $id ?>" /></div>
  3.  
hotel.php
Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2. function enable(obj)
  3. {
  4. var en1=document.getElementById("en1").value;
  5.     for(i=0;i<en1.length;i++)
  6.     {
  7.      if(en1[i].checked==true)
  8.      {
  9.          document.getElementById("en1").enabled=true;
  10.      }
  11.     }
  12. }
  13.  
  14. </script>
  15.  
  16.  
  17.  
Oct 9 '09 #1
1 2956
Markus
6,050 Expert 4TB
Though this text is in a PHP file, it is not PHP, or I can at least assume it isn not PHP because what you have already tried is Javascript. Ergo, I will move this to the Javascript forum where you will get more appropriate answers.
Oct 9 '09 #2

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

Similar topics

3
by: joe t. | last post by:
Here's what to look at: http://sawyer.thookerov.net/request/itrequest.php (script file: http://sawyer.thookerov.net/request/request.js The form works fine in Firefox. Clicking on certain...
5
by: Dani | last post by:
Hello everybody, I have some code that disables form elements on body load, but I notice when I hit the "back" button, I need to re-enable the form elements (that is done by clicking on a radial...
2
by: Cin | last post by:
I have a one-to-many relationship that I would like to convert to an unbound checkbox or radio buttons within a form. On form (pulls from tblEquipment) user can select one or all three choices...
1
by: scanreg | last post by:
My form needs to (1) direct to specified URLs based on a combination of form selections and (2) enable/disable form features based on selections within the form FORM Radio 1 - A - B - C ...
3
by: Search & You Will Find | last post by:
I have a database in Access 2000 that I need some help on. I have three tables: PROJECTS, SYSTEMS, & SYSTEMSREF. They possess the following fields: -----------------------------------...
4
by: clickingwires | last post by:
How do you disable/enable form elements with a check box. Like when it is check you cannot add anything to say name field?
2
by: mars123 | last post by:
hi, I am facing a js error in my code, below is the prob. statement I have a radio2 javascript function as below, it works like this.. When a parent radio button is selected only one of its...
1
by: ggfota | last post by:
How make some rows of a Form fully locked for edit based on criteria? Let's take two fields Date (criteria), Qty (editable). I will list all rows where Date is between DateFROM and DateTO. Now...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.