473,471 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

making checkbox non-editable

Hi,

I've few checkboxes in different rows. After selecting appropriate
values, the user should click a button. I wanted to convert those
checkbox values to non-editable(or non-editable textboxes), so that
user cannot change the value again after the needed functionality(this
is in java script) completes. So my problem is that how should i
manipulate the page through java script to set the field noneditable.

Please suggest.

Thanks,
Biswaranjan

Apr 28 '06 #1
4 5325
Also I can get the IDs of the checkboxes in java script function.

Biswaranjan

Apr 28 '06 #2
biswaranjan.rath said on 28/04/2006 3:54 PM AEST:
Hi,

I've few checkboxes in different rows. After selecting appropriate
values, the user should click a button. I wanted to convert those
checkbox values to non-editable(or non-editable textboxes), so that
user cannot change the value again after the needed functionality(this
is in java script) completes. So my problem is that how should i
manipulate the page through java script to set the field noneditable.

Please suggest.


Set the disabled attribute of any unchecked radios to true, then the
user can't select any other option.

If scripting is disabled/not available, it won't work. If there's a
reset button, the user can reset the form and clear the selections
anyway. There are probably other ways around it, don't rely on it
working for anything important.

Play with this:

<script type="text/javascript">

function fixSelections(rGroup)
{
var i = rGroup.length;
var j = i;
var oneChecked = false;

// Check that one has been selected
while (j-- && !oneChecked){
oneChecked = rGroup[j].checked;
}

// If one hasn't been selected, ask user to select one
if (!oneChecked) {
alert('Please check an option');
return;
}

// If one has been selected, disable the rest
while (i--){
rGroup[i].disabled = !rGroup[i].checked;
}
}

function enableRadios(rGroup)
{
var i = rGroup.length;
while (i--){
rGroup[i].disabled = false;
}
}

</script>

<form action=""><div>
<input type="radio" name="r1">button 1<br>
<input type="radio" name="r1">button 2<br>
<input type="radio" name="r1">button 3<br>
<input type="radio" name="r1">button 4<br>
<input type="button" value="Fix selection"
onclick="fixSelections(this.form.r1);"><br>
<input type="reset" onclick="enableRadios(this.form.r1);">
</div></form>

--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>
Apr 28 '06 #3
Hi Rob,
This is the solution for one set of radio buttons, still i'm in doubt
that it'll affect the page. Anyway could you have any idea if it is the
case of multiple dropdown lists, since in that case multiple names will
be there. Also i want this to be reflected in the html page.

Thanks,
Biswaranjan

Apr 28 '06 #4
biswaranjan.rath wrote on 28 apr 2006 in comp.lang.javascript:
This is the solution for one set of radio buttons, still i'm in doubt
that it'll affect the page. Anyway could you have any idea if it is the
case of multiple dropdown lists, since in that case multiple names will
be there. Also i want this to be reflected in the html page.


Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the article
headers. <http://www.safalra.com/special/googlegroupsreply/>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Phil Powell | last post by:
I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows: <script> <!-- function selectAll() { moveElement =...
2
by: Menelty | last post by:
I have 2 datagrids on my page and each one has a template column which has a checkbox relating to each specific row. I usually have one on the page and use javascript to make sure there has been x...
4
by: Piotr | last post by:
how can I read (in alert for example) array index number of checked checkbox? I have: <input type="checkbox" id="id_number" name="check" value="1" onclick="show()"/> <input type="checkbox"...
5
by: Dave | last post by:
Hi all, I'm new to ASP.NET and am working through a few exercises in a book to get up to speed. First, some background: I'm running SQL Server 2000 and have one field as a bit data type...
9
by: tshad | last post by:
I have a datagrid that I want to add a new column to. This column will only be visible under certain conditions. So I want to set the column visible=false. Then when the right condition happens...
1
by: nate axtell | last post by:
In VB .Net I made a custom CheckBox column style (for the Datagrid control) that maps to two DataTable columns , one it uses for the Checked status and the other it uses for the Enabled status. I am...
4
by: M | last post by:
Hello, I would like to get a value for a non selected checkbox in a form. Imagine my form contains : <input type='checkbox' name='t' value='1'> <input type='checkbox' name='t' value='1'> ...
8
by: PeteOlcott | last post by:
http://archive.dojotoolkit.org/nightly/dojotoolkit/dojox/grid/tests/test_change_structure.html I would like to completely understand how GUI controls such as this one are constructed. In the...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
6
by: rrlveloso09 | last post by:
---code--- if (readOnly) { //cb.disable(); cb.setEnabled(false); } when lower versions of jdk is used (lower than 1.4), the disable() method is working properly (meaning the checkbox...
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
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
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.