amiga.org
     
iconAll times are GMT -6. The time now is 10:44 AM. | Welcome to Forum, please register to access all of our features.

» Amiga.org » Coffee House » CH / Science and Technology » Need help with a Javascript to hide form items.

CH / Science and Technology This is the correct place for open, moderated discussions relating to science and technology. Open to Registered users only.

Reply
 
Thread Tools Display Modes
Old 05-01-2007, 07:57 AM   #1
Brian
Defender of the Faith
Points: 10,716, Level: 68 Points: 10,716, Level: 68 Points: 10,716, Level: 68
Activity: 1% Activity: 1% Activity: 1%
 
Join Date: Mar 2003
Location: Sweden
Posts: 1,446
Default Need help with a Javascript to hide form items.

I'm in need of a javascript that can hide several Form items (both checkboxes and option lists) so that only a small portion of the original form is visible but so that all the differen form items states (checkbox being pre-checked and option list being pre-selected) are still passed through when submitting.

I'm thinking it might be able to be done with a "Style value" to not interfear with the different names and values of the items in question?
__________________
/Brian
--
Computerhollic, Amiga is my fix!
Brian is offline   Reply With Quote
Old 05-01-2007, 12:26 PM   #2
motorollin
Premium Member
Points: 32,860, Level: 100 Points: 32,860, Level: 100 Points: 32,860, Level: 100
Activity: 54% Activity: 54% Activity: 54%
 
motorollin's Avatar
 
Join Date: Nov 2005
Posts: 8,666
Default Re: Need help with a Javascript to hide form items.

I'm not sure checkboxes and selection boxes have hidden/visible attributes. You could just create a hidden form control containing the value you want to post:

<input type="hidden" value="">

[EDIT]
The W3C's page on forms doesn't mention any hidden/visible attribues for any form elements other than the example above. See here.
[/EDIT]

--
moto
__________________
Code:
10  IT'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
motorollin is offline   Reply With Quote
Old 05-01-2007, 12:37 PM   #3
Karlos
Sockologist
Points: 48,752, Level: 100 Points: 48,752, Level: 100 Points: 48,752, Level: 100
Activity: 8% Activity: 8% Activity: 8%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: I solve practical problems...
Posts: 16,606
Blog Entries: 18
Default Re: Need help with a Javascript to hide form items.

Try setting e.style.display="none" / "" (where e is the form element object handle) to hide an element at the JS/CSS1 level. You can also use e.style.visibility="hidden" / "visible" where CSS2 is available.

Better still, wrap the form element in a <div> or a <span> and modify the style.display / .visibility property of that.

@Motorollin

Strictly speaking, any element that can take a style attribute can be made visible or invisible by modifying the element's style property itself, rather than the element, which as you say, is unlikely to have a visibility property of its own.
__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Old 05-01-2007, 12:45 PM   #4
motorollin
Premium Member
Points: 32,860, Level: 100 Points: 32,860, Level: 100 Points: 32,860, Level: 100
Activity: 54% Activity: 54% Activity: 54%
 
motorollin's Avatar
 
Join Date: Nov 2005
Posts: 8,666
Default Re: Need help with a Javascript to hide form items.

Bah! CSS is witchcraft!

--
moto
__________________
Code:
10  IT'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
motorollin is offline   Reply With Quote
Old 05-01-2007, 12:50 PM   #5
Karlos
Sockologist
Points: 48,752, Level: 100 Points: 48,752, Level: 100 Points: 48,752, Level: 100
Activity: 8% Activity: 8% Activity: 8%
 
Karlos's Avatar
 
Join Date: Nov 2002
Location: I solve practical problems...
Posts: 16,606
Blog Entries: 18
Default Re: Need help with a Javascript to hide form items.

__________________
OCA
This isn't SCSI... This is SATA!!!
I have CDO. It's like OCD except all the letters are in ascending order. The way they should be.
Core2 Quad Q9450 2.66GHz / X48T / 4GB DDR3 / nVidia GTX275 / Linux x64, AROS, Win64
A1XE 800MHz / 512MB / Radeon 9200 / OS4.1
A1200T BPPC 240MHz / 256MB / Permedia 2 / OS 3.1 - OS3.9, OS4
A1200T Apollo 1240 28MHz / 32MB / Mediator1200 / Voodoo 3000 / OS3.9
A1200D Apollo 1240 25MHz (ejector seat ROM edition) / 32MB
Karlos is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript , items , hide , form

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there any web browser that is able to display javascript menus? awe4k Amiga Software Issues and Discussion 3 03-12-2005 07:30 AM
Boy, not even trying to hide their racism anymore. redrumloa CH / Politics 73 12-05-2004 03:50 PM
AWeb 3.5b javascript.aweblib swift240 Amiga Software Issues and Discussion 4 07-17-2004 06:16 PM
Possible to easily hide/unhide partitions under XP??? Glaucus Alternative Operating Systems 6 04-13-2004 11:31 AM
IBrowse and Javascript ruffneck Amiga Software Issues and Discussion 0 05-08-2003 06:25 PM