473,387 Members | 3,781 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,387 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 2955
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.