Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
dynamic forms with div
Old 10-31-2005, 04:27 PM dynamic forms with div
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Hi. im using <div id> to dynamically change a form so when 1 of 2 radio buttons is selected the user is able to select from a dropdown menu, when the other is selected a message appears and the select box disappears. The problem is that when the page loads the contents of both div options appear on screen until the user selects one of the radio buttons- at this point one of the div options disappears and the required result is achieved. Anybody know how i can change the code so when the page loads only one of the div options appears? here is a simplified version of the form:

[js]
<form action='gethingeinfo2.php' NAME='hingeform' method='post'>
<SCRIPT>
function no() {hinge.style.visibility='visible';
binge.style.visibility='hidden';}
function yes(){binge.style.visibility='visible';
hinge.style.visibility='hidden';}
</SCRIPT>
No Back<input type='radio' name='back' value='No Back' checked='checked' onclick='no(); '>
With Back<input type='radio' name='back' value='With Back' onclick='yes();'>

<DIV ID='hinge' >
<SELECT NAME='hingetype' class='dropDownBoxGrey' ID='hingeask'>
<option value='Inset'><span id='normal'>Inset</span>
<option value='Surface'><span id='normal'>Surface</span>
</select>
</DIV>
<DIV ID='binge' >
you can do back and hinges
<input type='hidden' name='hingetype' value='No Hinges'>
</DIV>
[/js]

thanks for looking.
hiptobesquare is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-31-2005, 05:16 PM
praveen's Avatar
Life is a Dream

Posts: 3,591
Name: Praveen
Location: Chennai, India
Trades: 0
u can set one of the divs to be hidden and then when the selection is made then you can toggle the visibility..

else.. u can make both of them to be hidden and upon selection make the respective one visible.

since u r using id tags, its easier to do it this way
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
praveen is offline
Reply With Quote
View Public Profile
 
Old 10-31-2005, 05:46 PM
hiptobesquare's Avatar
Extreme Talker

Posts: 186
Location: London UK
Trades: 0
Job done. Thanks very much
hiptobesquare is offline
Reply With Quote
View Public Profile
 
Old 10-31-2005, 05:58 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
FYI, id tag names should only be used once, to identify one specific object/element. Use a class tag to define multiple items with the same attributes. <span id='normal'> should be <span class='normal'> because there are 2 of them.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to dynamic forms with div
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.57367 seconds with 12 queries