Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select List and Changing table rows

Status
Not open for further replies.

websh

Technical User
Jan 8, 2002
13
US
Hi,

I am looking for some help on a Javascript I need for a project. My Javascript skills are rusty from lack of use! Any assistance is appreciated.

Here is what I am trying to do:
I have a select list of payment types and I want to display some table rows based on what option is selected. For example, if a payment type of Check is selected, I want the table rows to display with the necessary fields to allow the user to enter information about a check, such as amount, check number, etc.

Here is the code:

<form name=&quot;paytype&quot;>
<table border=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;2&quot; width=&quot;95%&quot; name=&quot;payments&quot;>
<tr><td width=&quot;1%&quot; rowspan=&quot;30&quot;><img src=&quot;images/pixel.gif&quot; width=&quot;5&quot; height=&quot;1&quot;></td>
<td class=&quot;sectionhead1&quot; colspan=&quot;6&quot; width=&quot;100%&quot; align=&quot;left&quot; valign=&quot;top&quot; style=&quot;padding-bottom: 8px; padding-top: 5px;&quot;>Add Event Payment</td></tr>
<tr>
<td align=&quot;left&quot; valign=&quot;middle&quot; class=&quot;fieldlabel&quot;>Payment Type</td><td align=&quot;left&quot; valign=&quot;middle&quot; colspan=&quot;3&quot;>
<select name=&quot;paytype&quot; class=&quot;datainput&quot;>
<option value=&quot;null&quot; SELECTED>Select</option>
<option value=&quot;BankDraft&quot;>Bank Draft</option>
<option value=&quot;Check&quot; name=&quot;Check&quot;>Check</option>
<option value=&quot;CCard&quot; name=&quot;CCard&quot;>Credit Card</option>
<option value=&quot;Currency&quot; name=&quot;Currency&quot;>Currency</option>
<option value=&quot;MoneyOrder&quot;>Money Order</option>
</select>
</td>
</tr>
<tr><td colspan=&quot;5&quot;><img src=&quot;images/pixel.gif&quot; width=&quot;5&quot; height=&quot;5&quot;></td></tr>
<!--- Currency begins here--->
<tr name=&quot;Currency&quot; ID=&quot;Currency&quot; style=&quot;display: none;&quot;>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot;>Amount</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot; colspan=&quot;4&quot;>Comment</td>
</tr>
<tr name =&quot;Currency&quot; ID=&quot;Currency&quot; style=&quot;display: none;&quot;>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;payamt&quot; class=&quot;datainput&quot; size=&quot;10&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot; colspan=&quot;4&quot;><input type=&quot;Text&quot; name=&quot;cash&quot; class=&quot;datainput&quot; size=&quot;30&quot;></td>
</tr>
<!--- Currency ends here--->
<!--- Check, Money Order begins here--->
<tr name=&quot;Check&quot; ID=&quot;Check&quot; style=&quot;display: none;&quot;>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot;>Amount</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot;>Check Number</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot; colspan=&quot;3&quot;>Comment</td>
</tr>
<tr ID=&quot;Check&quot; style=&quot;display: none;&quot;>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;payamt&quot; class=&quot;datainput&quot; size=&quot;10&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;payamt&quot; class=&quot;datainput&quot; size=&quot;10&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot; colspan=&quot;3&quot;><input type=&quot;Text&quot; name=&quot;cash&quot; class=&quot;datainput&quot; size=&quot;30&quot;></td>
</tr>
<!--- Check, Money Order ends here--->
<!--- Credit Card begins here--->
<tr name=&quot;CCard&quot; ID=&quot;CCard&quot; style=&quot;display: none;&quot;>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot; width=&quot;15%&quot;>Card Type</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot; width=&quot;27%&quot;>Name on Card</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot; width=&quot;30%&quot;>Card Number</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot;>Exp. Date</td>
<td class=&quot;fieldlabel&quot; align=&quot;left&quot; valign=&quot;bottom&quot;>Security Code</td>
</tr>
<tr ID=&quot;CCard&quot; style=&quot;display: none;&quot;>
<td align=&quot;left&quot; valign=&quot;middle&quot;><cf_genQuery class=&quot;srchlabltxtbox&quot; name=&quot;card_type&quot; default_select=&quot;Select&quot; table=&quot;tcodes&quot; value=&quot;codeid&quot; desc=&quot;code_desc&quot; where_col=&quot;code_type&quot; where_value=&quot;CreditCard&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;name_on_card&quot; class=&quot;datainput&quot; size=&quot;25&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;card_no&quot; class=&quot;datainput&quot; size=&quot;25&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;card_exp_date&quot; class=&quot;datainput&quot; size=&quot;5&quot;></td>
<td align=&quot;left&quot; valign=&quot;middle&quot;><input type=&quot;Text&quot; name=&quot;card_security_no&quot; class=&quot;datainput&quot; size=&quot;5&quot;></td>
</tr>
<!--- Credit Card begins here--->
<tr><td colspan=&quot;5&quot;><img src=&quot;images/pixel.gif&quot; width=&quot;5&quot; height=&quot;5&quot;></td></tr>
</table>
</form>

I have tried several scripts, but no luck. I am open to suggestions.

Thanks,

sh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top