473,806 Members | 2,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can I disable and enable input type?

idsanjeev
241 New Member
Hi
its urgent
how can enable and desable the input field with condition like
if rs("field")=1 then
desable
elseif re("field")=2 then
enable
end if
and that after chek if the input type is enable then manadatory field can't null
thanks
Jan 12 '08
33 3541
idsanjeev
241 New Member
Hi gits
i send a new file attachment thats work fine but don't work when the hidden property is one time added in requistion other wise its work fine
the error thats displayed in status bar that is object require in javasript where function toggle_state is diclare and compare with one .
Jan 18 '08 #31
gits
5,390 Recognized Expert Moderator Expert
hi ...

in your attached code you have:

Expand|Select|Wrap|Line Numbers
  1. <input type="text" name="purpose" style="visibility:hidden; width:400px" maxlength="150" value=<%=porpose%>>
add an id-attribute since the toggle-function relies on it ...

kind regards
Jan 18 '08 #32
idsanjeev
241 New Member
Hi gits
Thanks for your kind time to time guidance
this code work fine

Expand|Select|Wrap|Line Numbers
  1. function toggle_state(obj) {
  2.     // here we check the value of your select-box
  3.    //var val = obj.value == 1; 
  4.  
  5.     if (obj.value == 1)
  6.  {
  7.  val=1;
  8.  }
  9.  else
  10.  {
  11.  val=0;
  12.  }
  13.  
  14.     var input_node = document.getElementById('purpose');
  15.  
  16.     input_node.style.visibility = val ? 'hidden' : 'visible';
  17.  
  18. }
  19. </script>
Jan 19 '08 #33
gits
5,390 Recognized Expert Moderator Expert
Hi gits
Thanks for your kind time to time guidance
this code work fine

Expand|Select|Wrap|Line Numbers
  1. function toggle_state(obj) {
  2.     // here we check the value of your select-box
  3.    //var val = obj.value == 1; 
  4.  
  5.     if (obj.value == 1)
  6.  {
  7.  val=1;
  8.  }
  9.  else
  10.  {
  11.  val=0;
  12.  }
  13.  
  14.     var input_node = document.getElementById('purpose');
  15.  
  16.     input_node.style.visibility = val ? 'hidden' : 'visible';
  17.  
  18. }
  19. </script>
your adaption is definitly equivalent to the simple one line that you have 'outcommented' ... this couldn't have made a problem ... simply produces more lines of code and worse performance since 0 and 1 has to evaled to false/true in our assignment later on ... so it has to work with the

Expand|Select|Wrap|Line Numbers
  1. var val = obj.value == 1; 
  2.  
too?

kind regards
Jan 19 '08 #34

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

Similar topics

2
9749
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...
2
6474
by: HolaGoogle | last post by:
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...
12
8901
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
1
2473
by: Manatee | last post by:
Hi group. I have exactly one external, alternate stylesheet that I want to enable or disable by form controls, on one page only (not saved across pages). I used: <link rel="alternate stylesheet" id="style-compact" etc...> <input name="view" type="radio" onclick="document.getElementById('style-compact').disabled=false">
1
4258
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...
2
26378
by: Kevin | last post by:
I've been looking all over and I can't seem to find what ought to be simple. I need to disable a drop down when a checkbox is checked, and enable it when same checkbox is unchecked. I've found any number of scripts to disable / enable a drop down but they are all made to work with 2 different buttons, radio group selections, etc. I can't seem to come up with one that can toggle off a single checkbox.
5
14284
by: metalwing12 | last post by:
Hi guys can someone kindly help me about my code it seems incomplete or i just can make it right .I try using the disabled property of the textbox yes it workss, it disable it but when i set it to false like disabled="false" it does not enable the textbox.This is my code <p><input type="text" name="txtbox1" size="20" disabled="true"> <input type="button" value="Click" name="B3" disabled="true"> Operator</p> <p><input...
10
5102
by: viki1967 | last post by:
Disable/enable icon.gif Hi all. I have this form in the page.htm: <form action="form.asp" method="post" onsubmit="return(validateForm(this));"> <select size="1" name="t_im" onchange="Form()">
10
9116
by: sowmyati | last post by:
HI All, I am new to javascript. I have snippet wherein i am giving a brief note on what i am trying to do. In the below have a variable by name stuff. trying to reset the page. Part of the code which does reset is attached below. there is a reset button which will reset the connection and it takes two min for data loading during which the reset button has to be disabled and later after two mins it should enable the button for the user. ...
0
9597
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10618
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
10366
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
10371
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,...
1
7649
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
6877
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5546
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...
2
3850
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.