Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-03-2008, 04:56 AM   PM User | #1
shariff
New to the CF scene

 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
shariff is an unknown quantity at this point
Javascript help needed...!

Good day to everyone,

I have designed a request form where I have three option buttons:

1. Service Request
2. Product Request
3. Both

By default service request is enabled, on selection of product request it have to show the field of product request form and on selecting both option button both the form should be available and vise versa.

Since I have started learning I would request your help or any source where I can build this kind of forms.

Your comments and queries of the above will highly appreciated.

Regards
shariff is offline   Reply With Quote
Old 07-03-2008, 05:25 AM   PM User | #2
rangana
Senior Coder

 
rangana's Avatar
 
Join Date: Feb 2008
Location: Cebu City, Philippines
Posts: 1,752
Thanks: 65
Thanked 372 Times in 365 Posts
rangana will become famous soon enoughrangana will become famous soon enough
See if this basic example helps:
Code:
<script type="text/javascript">
window.onload=function()
{
var sr=document.getElementById('sr'), // get the ID of the Service Request button
pr=document.getElementById('pr'), // get the ID of the Product Request button
both=document.getElementById('both'), // get the ID of Both button
service_req=document.getElementById('service_req'), 
// get the ID of the element (div) that holds Service Requests's content
product_req=document.getElementById('product_req') ;
// get the ID of the element (div) that holds Product Requests's content
sr.onclick=function(){reset();service_req.style.display='';}
pr.onclick=function(){reset();product_req.style.display='';}
both.onclick=function(){reset();service_req.style.display='';
product_req.style.display='';}
reset();
}
function reset()
{
service_req=document.getElementById('service_req'), 
// get the ID of the element (div) that holds Service Requests's content
product_req=document.getElementById('product_req') ;
// get the ID of the element (div) that holds Product Requests's content
service_req.style.display='none';
product_req.style.display='none';
}
</script>
<input type="button" value="Service Request" id="sr">
<input type="button" value="Product Request" id="pr">
<input type="button" value="Both" id="both">
<div id="service_req">
<h1>Service Request</h1>
Contents Here. All the elements you wish which includes form.
</div>
<div id="product_req">
<h1>Product Request</h1>
Contents Here. All the elements you wish which includes form.
</div>
__________________
Learn how to javascript at 02geek

The more you learn, the more you'll realize there's much more to learn
Ray.ph
rangana is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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


All times are GMT +1. The time now is 06:50 PM.


Advertisement
Log in to turn off these ads.