Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 05-31-2007, 11:02 PM   #1 (permalink)
Junior Member
 
Join Date: 12-21-06
Posts: 2
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
Old 05-31-2007, 11:49 PM   #2 (permalink)
Junior Member
 
Join Date: 12-21-06
Posts: 2
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, 09:53 PM   #3 (permalink)
Meeow!
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 3,235
iTrader: 0 / 0%
Latest Blog:
None

Costin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest orderCostin Trifan is a web professional of the highest order
Quote:
I got it sorted using:....
Thanks for letting us know !
__________________
...to be continued
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-01-2007, 11:32 PM   #4 (permalink)
Junior Member
 
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 > 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

BB 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 6 06-12-2009 03:36 AM
How to use Ajax for a simple web form? ladan Coding Forum 3 01-18-2007 03:24 AM
Your recommended Form Field Validation Javascript bestempire Coding Forum 1 05-30-2006 08:18 AM
Javascript Form Validation Help ATLien Coding Forum 9 03-13-2006 01:36 PM
Javascript: form text to bold onclick DragonEye Coding Forum 2 10-17-2004 08:31 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 05:23 AM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.