Jump to content

Display form field with if statement


Recommended Posts

Hello..

 

I have a payment confirmation form module, but i want to add some field. Here's some of field on my .tpl form:

 

 

<p class="required text">
<label for="payment_method">{l s='Payment method' mod='paymentconfirmation'}</label>
<select name="payment_method" id="payment_method">{$paymentmethod}</select>
<sup>*</sup>
</p>
<p class="text">
<label for="from_bank">{l s='From Bank' mod='paymentconfirmation'}</label>
<input type="text" id="from_bank" name="from_bank" />
</p>
<p class="text">
<label for="from_name">{l s='Account Name' mod='paymentconfirmation'}</label>
<input type="text" id="from_name" name="from_name" />
</p>
<p class="text">
<label for="from_number">{l s='Account Number' mod='paymentconfirmation'}</label>
<input type="text" id="from_number" name="from_number" />
</p>

 

the $paymentmethod would showing 2 option value :

- Bank Wire Transfer

- Cheque Payment

 

what i want to achieve is.. how to make the From Bank, Account Name, Account Number field is displayed if the $paymentmethod = Bank Wire Transfer?

 

i'm trying to sort it out by editing the .tpl form into this :

 

 

<p class="required text">
<label for="payment_method">{l s='Payment method' mod='paymentconfirmation'}</label>
<select name="payment_method" id="payment_method">{$paymentmethod}</select>
<sup>*</sup>
</p>
{if $paymentmethod = 'Bank Wire Transfer}
<p class="text">
<label for="from_bank">{l s='From Bank' mod='paymentconfirmation'}</label>
<input type="text" id="from_bank" name="from_bank" />
</p>
<p class="text">
<label for="from_name">{l s='Account Name' mod='paymentconfirmation'}</label>
<input type="text" id="from_name" name="from_name" />
</p>
<p class="text">
<label for="from_number">{l s='Account Number' mod='paymentconfirmation'}</label>
<input type="text" id="from_number" name="from_number" />
</p>

{/if}

 

but it doesn't work out.. does anybody know how to fix this?

Edited by juraganpsd (see edit history)
Link to comment
Share on other sites

ahhh.. you're right @tomerg3!

 

but it still doesn't work :(

 

the field doesn't show up when i select the "Bank Wire Transfer" :mellow:

 

<p class="required text">
<label for="payment_method">{l s='Payment method' mod='paymentconfirmation'}</label>
<select name="payment_method" id="payment_method">{$paymentmethod}</select>
<sup>*</sup>
</p>
{if $paymentmethod == 'Bank Wire Transfer'}
<p class="text">
<label for="from_bank">{l s='From Bank' mod='paymentconfirmation'}</label>
<input type="text" id="from_bank" name="from_bank" />
</p>
<p class="text">
<label for="from_name">{l s='Account Name' mod='paymentconfirmation'}</label>
<input type="text" id="from_name" name="from_name" />
</p>
<p class="text">
<label for="from_number">{l s='Account Number' mod='paymentconfirmation'}</label>
<input type="text" id="from_number" name="from_number" />
</p>
{/if}

Edited by juraganpsd (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...