473,386 Members | 1,785 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,386 software developers and data experts.

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 enableOtherPhysicians()
{
if (!document.getElementById) return;

var s1 = document.getElementById('referpersonID');
if (!s1) return;
if (s1.options[s1.selectedIndex].value != 'referpersonID') return;
var t1 = document.getElementById('referpersonIDnew');
var d1 = document.getElementById('delete1');
if (!t1) return;
t1.disabled = false;
t1.className = '';
d1.disabled = true;
d1.className = '';

var s3 = document.getElementById('physicianID');
if (!s3) return;
if (s3.options[s3.selectedIndex].value != 'physicianID') return;
var t3 = document.getElementById('physicianIDnew');
var d3 = document.getElementById('delete3');
if (!t3) return;
t3.disabled = false;
t3.className = '';
d3.disabled = true;
d3.classname = '';
}

function initPhysicians()
{
if (!document.getElementById) return;

var s1 = document.getElementById('referpersonID');
if (!s1) return;
s1.onchange = enableOtherPhysicians;
var t1 = document.getElementById('referpersonIDnew');
var d1 = document.getElementById('delete1');
if (!t1) return;
t1.disabled = true;
t1.className = 'person_hidden';
d1.disabled = false;
d1.className = 'person_hidden';

var s3 = document.getElementById('physicianID');
if (!s3) return;
s3.onchange = enableOtherPhysicians;
var t3 = document.getElementById('physicianIDnew');
var d3 = document.getElementById('delete3');
if (!t3) return;
t3.disabled = true;
t3.className = 'physician_hidden';
d3.disabled = false;
d3.classname = 'physician_hidden';
}

window.onload = initPhysicians;
Jul 27 '08 #1
1 1385
On Jul 27, 1:36 pm, Malinmore <tim.carri...@gmail.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("initPhysicians() started");
if (!document.getElementById) {
alert("No document.getElementByID method");
return false;
}

var s1 = document.getElementById('referpersonID');
if (s1) {
s1.onchange = enableOtherPhysicians;
} else {
alert("referpersonID not found");
return false;
}
var t1 = document.getElementById('referpersonIDnew');
if (t1) {
t1.disabled = true;
t1.className = 'person_hidden';
} else {
alert("referpersonIDnew not found");
return false;
}
var d1 = document.getElementById('delete1');
....

C.
Jul 27 '08 #2

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

Similar topics

11
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...
2
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...
6
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,...
4
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...
17
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...
3
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...
2
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...
17
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...
162
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...
27
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: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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,...
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...

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.