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