473,803 Members | 3,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

hiding-enabling text fields

the following works well regarding one select box with one hidden text
box. however I need two unique select boxes with relevant hidden text
boxes that un-hide when the Add New option is selected. the problem is
that the upper hidden text box always appears when the page is loaded.
Can anyone tells me why?

//physicianID

function enableOtherPhys icians()
{
if (!document.getE lementById) return;

var s1 = document.getEle mentById('refer personID');
if (!s1) return;
if (s1.options[s1.selectedInde x].value != 'referpersonID' ) return;
var t1 = document.getEle mentById('refer personIDnew');
var d1 = document.getEle mentById('delet e1');
if (!t1) return;
t1.disabled = false;
t1.className = '';
d1.disabled = true;
d1.className = '';

var s3 = document.getEle mentById('physi cianID');
if (!s3) return;
if (s3.options[s3.selectedInde x].value != 'physicianID') return;
var t3 = document.getEle mentById('physi cianIDnew');
var d3 = document.getEle mentById('delet e3');
if (!t3) return;
t3.disabled = false;
t3.className = '';
d3.disabled = true;
d3.classname = '';
}

function initPhysicians( )
{
if (!document.getE lementById) return;

var s1 = document.getEle mentById('refer personID');
if (!s1) return;
s1.onchange = enableOtherPhys icians;
var t1 = document.getEle mentById('refer personIDnew');
var d1 = document.getEle mentById('delet e1');
if (!t1) return;
t1.disabled = true;
t1.className = 'person_hidden' ;
d1.disabled = false;
d1.className = 'person_hidden' ;

var s3 = document.getEle mentById('physi cianID');
if (!s3) return;
s3.onchange = enableOtherPhys icians;
var t3 = document.getEle mentById('physi cianIDnew');
var d3 = document.getEle mentById('delet e3');
if (!t3) return;
t3.disabled = true;
t3.className = 'physician_hidd en';
d3.disabled = false;
d3.classname = 'physician_hidd en';
}

window.onload = initPhysicians;
Jul 27 '08 #1
1 1405
On Jul 27, 1:36 pm, Malinmore <tim.carri...@g mail.comwrote:
the following works well regarding one select box with one hidden text
box. however I need two unique select boxes with relevant hidden text
boxes that un-hide when the Add New option is selected. the problem is
that the upper hidden text box always appears when the page is loaded.
Can anyone tells me why?
No because your description relates to the position of the elements
while the code operates on their IDs. Your code is badly written and
you don't appear to have made any effort at diagnosing the fault
yourself.

You might want to
1) see if you are getting any javascript errors at runtime
2) try somethnig along the lines of:

function initPhysicians( )
{
alert("initPhys icians() started");
if (!document.getE lementById) {
alert("No document.getEle mentByID method");
return false;
}

var s1 = document.getEle mentById('refer personID');
if (s1) {
s1.onchange = enableOtherPhys icians;
} else {
alert("referper sonID not found");
return false;
}
var t1 = document.getEle mentById('refer personIDnew');
if (t1) {
t1.disabled = true;
t1.className = 'person_hidden' ;
} else {
alert("referper sonIDnew not found");
return false;
}
var d1 = document.getEle mentById('delet e1');
....

C.
Jul 27 '08 #2

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

Similar topics

11
4198
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give me an example of something hidden from the user?
2
2390
by: coolwarrior | last post by:
Hi, 1_I want to know the difference between "data hiding" , "steganography" ,"watermarking" ,"capsulation" related to DSP. 2_There r plenty of informaion about data hiding for images on the web ,but I'm looking for a GOOD keyword for searching "signal/speech data hiding/steganography"...Do u have any suggestion about appropriate keywords or websites? thanQ so much 4 ur care! coOlwarrior4ever
6
538
by: harrylmh | last post by:
Hi, I'm learning C# and I just don't quite understand the need for polymorphism. why do we need to use it? how does a base class variable holding a derived class instance do any good? Also, what's the difference between method hiding and overriding when they're both still overriding the base method. Thanks
4
4155
by: Sharon Tal | last post by:
Hi all. I am trying to figure out the differences between overriding and hiding a method name. The only difference i can see, is that with name hiding i can change the method access level. Are there any other differences? Thanks, Sharon.
17
2921
by: Bob Weiner | last post by:
What is the purpose of hiding intead of overriding a method? I have googled the question but haven't found anything that makes any sense of it. In the code below, the only difference is that when the Poodle is upcast to the Dog (in its wildest dreams) it then says "bow wow" where the bernard always says "woof" (see code). Basically, it appears that I'm hiding the poodle's speak method from everything except the poodle. Why would I...
3
6580
by: Nicolas Castagne | last post by:
Hi all, I have been wondering for a while why function hiding (in a derived class) exists in C++, e.g. why when writing class Base { void foo( int ) {} }; class Derived: public Base { void foo( char const ) {} };
2
7644
by: subramanian100in | last post by:
Is my following understanding correct ? Data abstraction means providing the interface - that is, the set of functions that can be called by the user of a class. Information hiding means mentioning the class members(functions, typedefs, data) under the access control labels : public, protected, private. Encapsulation means providing the implementation of class member
17
2030
by: rohitchawla | last post by:
i am trying to show and hide a div when onmouseover and onmouseover another div element. i am setting a setTimeout duration on onmouseout to delay the hiding of div for around two second The problem is that when i mouseover an element and then onmouseout it and then back again mouseovers that element before the timeout, the element still gets hidden so i put a flag=1 when i mouseover the element and flag=0 at mouseout and checked the value...
162
10316
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you prefix them with 2 underscores, but I hate prefixing my vars, I'd rather add a keyword before it. Python advertises himself as a full OOP language, but why does it miss one of the basic principles of OOP? Will it ever be added to python?
27
2789
by: matt | last post by:
Hello group, I'm trying to become familiar with the information hiding design rules, and I have a lot (3) of questions for all you experts. AFAIK, a generic module has 2 files: ================ module.h ================ #ifndef __MODULE_HDR_INCLUDED__
0
9700
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9564
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
10546
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
10310
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
10292
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
9121
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...
0
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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
3
2970
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.