Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Directory Submission Service   ClickBooth Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 05-31-2007, 10:02 PM   #1 (permalink)
Inactive
 
Join Date: 12-21-06
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

adammc is liked by many
Ajax / Javascript Form Help

Hi folks,

Could any one tell me please if it is possible to make a radio button that shows a text input field only when it is checked?

example:


PHP Code:
<tr>
        <
td valign='center'>Payment Method: </td>
        <
td valign='center'>
        <
input type=radio name="payment_method" class="radio" value="paymate" />Paymate &nbsp
        <
input type=radio name="payment_method" class="radio" value="paypal" />Paypal </td>
</
tr
If the user selects the paymate radio button the following would display / show on the page:

PHP Code:
<tr>
<
td width="133">Paymate ID</td><td width="148"><input type="text" name="paymate_id" size="20"></td>
</
tr
If the user selects the paypal radio button the following would display:

PHP Code:
<tr>
<
td width="133">Paypal ID</td><td width="148"><input type="text" name="paypal_id" size="20"></td>
</
tr
Any advice would be greatly appeciated
adammc is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 05-31-2007, 10:49 PM   #2 (permalink)
Inactive
 
Join Date: 12-21-06
Posts: 3
iTrader: 0 / 0%
Latest Blog:
None

adammc is liked by many
I got it sorted using:

PHP Code:
<head>
<
script language="javascript">
function 
ShowHide(frm){
    if(
frm.payment[0].checked == true){
        
document.getElementById('Paymate').style.display '';
        
document.getElementById('Paypal').style.display 'none';
    }
    if(
frm.payment[1].checked == true){
        
document.getElementById('Paymate').style.display 'none';
        
document.getElementById('Paypal').style.display '';
    }
}
</script>
</head> 
PHP Code:
<form name="frm1">
<
table width="350" border="0" cellspacing="1" cellpadding="3">
  <
tr>
    <
td width="77" align="right" valign="middle"><input name="payment" type="radio" value="Paymate" onClick="ShowHide(this.form);"></td>
    <
td width="250">Paymate</td>
  </
tr>
  <
tr>
    <
td align="right" valign="middle"><input name="payment" type="radio" value="Paypal" onClick="ShowHide(this.form);"></td>
    <
td>Paypal</td>
  </
tr>
  
  <
tr>
    <
td colspan="2" align="left" valign="middle" id="Paymate" style="display:none;"><table width="100%" border="0" cellspacing="2" cellpadding="1">
      <
tr>
        <
td width="23%" align="left" valign="middle">Paymate ID </td>
        <
td width="77%">:
          <
input name="PaymateID" type="text" id="PaymateID"></td>
      </
tr>
      
    </
table></td>
  </
tr>
  <
tr>
    <
td colspan="2" align="left" valign="middle" id="Paypal" style="display:none;"><table width="100%" border="0" cellspacing="2" cellpadding="1">
      <
tr>
        <
td width="23%" align="left" valign="middle">Paypal ID </td>
        <
td width="77%">:
          <
input name="PaypalID" type="text" id="PaypalID"></td>
      </
tr>
    </
table></td>
  </
tr>
</
table>
</
form
adammc is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-01-2007, 08:53 PM   #3 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,968
iTrader: 0 / 0%
Latest Blog:
Ok, so we're back

Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Quote:
I got it sorted using:....
Thanks for letting us know !
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-01-2007, 10:32 PM   #4 (permalink)
Inactive
 
petra036's Avatar
 
Join Date: 05-31-07
Location: Wellington, New Zealand
Posts: 5
iTrader: 0 / 0%
Latest Blog:
None

petra036 is liked by many
Oh yes. Sure. I have scanned the web and have seen thousands of websites with that. I could easily find it again, or make it.
petra036 is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create this Javascript form? ladan Coding Forum 5 01-23-2007 06:57 PM
How to use Ajax for a simple web form? ladan Coding Forum 3 01-18-2007 02:24 AM
Your recommended Form Field Validation Javascript bestempire Coding Forum 1 05-30-2006 07:18 AM
Javascript Form Validation Help ATLien Coding Forum 9 03-13-2006 12:36 PM
Javascript: form text to bold onclick DragonEye Coding Forum 2 10-17-2004 07:31 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 04:40 PM.
© Copyright 2008 V7 Inc

Click Here