473,888 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ENABLE/DISABLE CHECKBOXES AND TEXTBOXES PROBLEM

Can you please tell me the right way to do this?? it's realy
important! thanks in advance...
Hi all,
Can you please tell me what's wrong with my code??? i do have this
database in wich i have to field.One is a "yes/no" field and another
one is "number" field. To display the yes/no field in my asp form i
use a checkbox and fot he other field i use a normal text box. if the
yes/no field is checked then the other field is enabled otherwise it
has to be disabled.Here's what i've done so far:

Do While Not ObjRS.EOF
<td><input type="checkbox" name="ChkboxNam e"value=1 <%IF
ObjRS("chkbox") = TRUE
THEN %> CHECKED onclick="ChkBox Checked()<% END IF %>
<%if (ObjRS("chkbox" ))Then %>//if the yes/no field value is yes
enable textbox
<input type="text"name ="FieldToEnabe" value=<%=ObjRS( "EnableField")% >>
<%ELSE%>//else if the value field is no. disable text box but if the
user
//clicks enables the checkbox then enable the textbox too.
<input type="text" disabled name="FieldToEn abe"value=<%=Ob jRS
("EnableField") %>
<%End if%>
ObjRS.MoveNext

function ChkBoxChecked()//this method is used when the user
enable/disable the
//checkbox, if it's enabled then the txtbox is enabled too.
{
if(document.Myf orm.ChkboxName. checked==true)
{
document.Myform .FieldToEnabe.d isabled=true;
}
else
{
document.Myform .FieldToEnabe.d isabled=false;
}
}

this obviously doesn't work. So...can someone tell me what i'm doing
wrong please??
thaks a lot!
Jul 19 '05 #1
2 6480
See your first thread about this from one day prior.

Ray at home

"HolaGoogle " <ho*****@yahoo. com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
Can you please tell me the right way to do this?? it's realy
important! thanks in advance...

Jul 19 '05 #2
Hey Ray (and everybody)
your answer works perfectly!! now when i click on my checkbox it
enables/disables my text box...thanks a bunch!!! BUT...i still have 2
more questions :
1) i want my textbox to be always displayed with or without a
value.(actualy it's displayed only if it contains a value. So, do you
think that i can do something like this:
<% If CBool(ObjRS.Fie lds.Item("chkbo x").Value) Then %>
<input type="text"name ="FieldToEnabe" value=<%=ObjRS( "EnableField")% >>
<%else%>
<input disabled type="text"name ="FieldToEnabe" value=0>
<%end if %>

for the moment this doesn'work...

Thanks a lot...

"Ray at <%=sLocation% >" <myfirstname at lane 34 . komm> wrote in message news:<OY******* *******@TK2MSFT NGP09.phx.gbl>. ..
See your first thread about this from one day prior.

Ray at home

"HolaGoogle " <ho*****@yahoo. com> wrote in message
news:cd******** *************** ***@posting.goo gle.com...
Can you please tell me the right way to do this?? it's realy
important! thanks in advance...

Jul 19 '05 #3

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

Similar topics

2
9750
by: HolaGoogle | last post by:
Hi all, Can you please tell me what's wrong with my code??? i do have this database in wich i have to field.One is a "yes/no" field and another one is "number" field. To display the yes/no field in my asp form i use a checkbox and fot he other field i use a normal text box. if the yes/no field is checked then the other field is enabled otherwise it has to be disabled.Here's what i've done so far: Do While Not ObjRS.EOF <td><input...
1
4261
by: hortoristic | last post by:
We are using JavaScript to Enable/Disable certain fields on web pages based on business rules. A simple example is if when using an option type tag, and the two options are Yes and No. If YES is selected - enable a field to use the M$ Datepicker. Using the code below works for most of our fields, however the problem is that when the field is re-enabled - it remembers the original date or data prior to it being disabled - despite the...
9
4965
by: Susan Bricker | last post by:
Hi. I have two questions ... (1) I want to use a Listbox to enable the user to select 1 or many items from the list. However, I'm having trouble figuring out how to find out t which items have been selected. How can I do that? Given the listindex, .selected, .itemsselected, .itemdata properties -- I'm getting confused. (2) I, actually, have two listboxes on the form and I want to ONLY let the user select items in one list. The...
2
1532
by: MaryA | last post by:
i have an aspx form containing several textboxes.Is there a way with a for loop or something to enable or disable the textboxes, instead of writing textboxName.enable i appriciate any help i need that method waiting for a quick response Thanks a lot
9
4389
by: Marc | last post by:
Okay, here's the problem - I have 3 radio buttons, and 11 check boxes (which are disabled by default). I have the javascript below which when the last radio button is clicked, enables the checkboxes. <script type="text/javascript"> //<!]> </script> I used the JavaScript on 2 pages, on almost identical forms, and for some reason it doesn't work on the 2nd one - they just stay disabled,
4
3545
by: chengsi | last post by:
Hi all, This is my first post, so please excuse if i am posting a silly question. I have an MS Access database and have created a tabulated form (where there are multiple lines, one for each record - similar to a table, hence the name). There are about 10 fields or so, and i have used textboxes, combo-boxes and checkboxes to represent the fields. What I am trying to do is to enable or disable textbox_2, depending on the value of...
5
11286
by: masterej | last post by:
Developers, Is there any way to disable all checkboxes on a form? I have a form with 160 checkboxes and I want to be able to disable all of them. Is there a way I can do something like this: for (int i = 0; i < 160; i++) { string checkbox = "checkBox" + i.toString(); (Cast)checkbox.enabled = false;
1
3894
by: javasachin | last post by:
Hello, I want to enable Struts2 Submit button <s:submit> in the client side using JavaScript based on the user inputs in some other controls (textboxes). If user is not entering any values in the text boxes, I want to disable the <s:submit> and if user enters any text, then I want to enable this <s;submit. button. Can you kindly tell me how to do this??? Thanks in advance. Regards, Sachin
1
2250
by: zufie | last post by:
I have a main form containing 2 checkboxes. The respective checkboxes when checked cause the SepcialEffect Property to make all the textboxes to appear Shadowed. 1)Although the Textboxes and Combo Boxes required to appear Shadowed are almost the same regardless of the checkbox that is checked how do I cause individual textboxes to appear Flat? 2)How do I cause the Textboxes and Combo Boxes to highlight upon
0
11180
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10778
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10439
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9597
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7990
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5817
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6014
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4642
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.