Re: Scripting to hide text field

  • From: "Peter Donahue" <pdonahue1@xxxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 26 Nov 2007 14:14:00 -0600

Hello Bryan,

Do I place this JavaScript in the page header, or above the "selection combo
box to which it is being applied?  If you had the code of an actual page I
can explore that would enable me to see how it must be put together to work
correctly. Thanks for the script and your help.

Peter Donahue

----- Original Message ----- 
From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, November 26, 2007 1:24 PM
Subject: Re: Scripting to hide text field


This is from the page at
http://gutterstar.net/cgi-bin/forum/index.php?showtopic=339

This JavaScript function will toggle the hiding or showing of any element or
section based on the ID passed to the function.

CODE

<script type="text/javascript">
function toggleHide(eID) {
var e = document.getElementById(eID);
if (e.style.display == 'block') {
e.style.display = 'none';
e.style.visibility = 'hidden';
} else {
e.style.display = 'block';
e.style.visibility = 'visible';
}
}
</script>

To use it, you simply put the following attribute in your element.

onchange="toggleHide('IDOfElementToToggle')"

So, when the element with the attribute above changes, it will hide or show
the element with the attribute of

id="IDOfElementToToggle"

Hope this helps,

Bryan

----- Original Message ----- 
From: "Marlon Brandão de Sousa" <splyt.lists@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, November 26, 2007 3:30 AM
Subject: Re: Scripting to hide text field


> Also if you hide and show a text box in a web form chances are that
> most part of screen readers will find trouble to read your page what,
> I presume, you wouldn't like to see it happening...
> What you need to do is use javascript to see what option has been
> selected by the user and react accordingly. Place a onChange statement
> in your combobox declaration. Make this onChange call a javascript
> function, where you will place code to verify what item has been
> selected in the combobox. And, if the other option is selected, just
> enable a text box control, otherwise disable it.
> I won't past the necessary code here, because google will show you
> what you need, and this is a great oportunity to learn a little of
> javascript. If you however enconter any thing you don't understand ask
> to the list again.
> Marlon
>
> 2007/11/26, Octavian Rasnita <orasnita@xxxxxxxxx>:
>> You cannot do that using a server side language like PHP. You must do it
>> using Javascript, or another client side programming language.
>>
>> Octavian
>>
>> ----- Original Message -----
>> From: "Peter Donahue" <pdonahue1@xxxxxxxxxxxxx>
>> To: <programmingblind@xxxxxxxxxxxxx>
>> Sent: Monday, November 26, 2007 1:29 AM
>> Subject: Re: Scripting to hide text field
>>
>>
>> > Hello Jaffar,
>> >
>> >    This particular site was created using PHP. Another site I have is
>> > .shtml. I was thinking JavaScript, but can this be done using PHP? This
>> > is
>> > where I could use some enlightenment as to the best language to use for
>> > creating such a function. Thanks.
>> >
>> > Peter Donahue
>> >
>> >
>> > ----- Original Message -----
>> > From: "jaffar" <jaffar@xxxxxxxxxxxxx>
>> > To: <programmingblind@xxxxxxxxxxxxx>
>> > Sent: Sunday, November 25, 2007 5:25 PM
>> > Subject: Re: Scripting to hide text field
>> >
>> >
>> > Hi Peter.  In which language would you be scripting this form?  Cheers!
>> > ----- Original Message -----
>> > From: "Peter Donahue" <pdonahue1@xxxxxxxxxxxxx>
>> > To: <blindwebbers@xxxxxxxxxxxxxxx>
>> > Cc: <nfb-web@xxxxxxxxxx>; <programmingblind@xxxxxxxxxxxxx>
>> > Sent: Monday, November 26, 2007 7:03 AM
>> > Subject: Scripting to hide text field
>> >
>> >
>> >> Hello again everyone,
>> >>
>> >>    I will be building a contact form for one of my Web sites. The form
>> >> will
>> >> contain a select box with options the user must select. If the user
>> >> selects
>> >> the, "Other" option I want them to be able to enter the desired
>> >> information
>> >> in a text field to appear below the selection box. Otherwise I don't
>> >> want
>> >> this field to show if the, "Other" option is not selected. Can you
>> >> point
>> >> me
>> >> to sources for scripting to perform this function within a form, or
>> >> send
>> >> me
>> >> code samples of such forms? I'll appreciate that very much.
>> >>
>> >> Peter Donahue
>> >>
>> >>
>> >> __________
>> >> View the list's information and change your settings at
>> >> //www.freelists.org/list/programmingblind
>> >>
>> >
>> > __________
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/programmingblind
>> >
>> > __________
>> > View the list's information and change your settings at
>> > //www.freelists.org/list/programmingblind
>> >
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>>
>
>
> -- 
> When you say "I wrote a program that crashed Windows," people just
> stare at you blankly and say "Hey, I got those with the system, for
> free."
> Linus Torvalds
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: