0

I am struggling with a form element. I like to have a options dropdown menu, but with an extra textfield input.

something like

<select name="gateway_code" id="gateway_code">
<option value="">---------</option>
<option value="ideal">Cash</option>
<option value="paypal">PayPal</option>
<option value="creditcard">Credit Card (Visa, Mastercard)</option>
</select> or
Vouchercode <input type="text" id="gateway_code" name="gateway_code" value""/>

How can i make this?

regards

alex
  • 4,804
  • 14
  • 51
  • 86
  • I don't understand the question, can you explain further? Your HTML already shows a select field and an input field?? – DAC84 Feb 28 '14 at 10:06
  • @DAC84 i am having problems with requirements and conditional statement. If an user has a valid voucher code a ticket is immediately send else a payment must be selected. – alex Feb 28 '14 at 10:15
  • That isn't what you're question is asking. That logic isn't created using HTML form elements. You either need to do that logic using server-side code, or using Javascript to check the voucher is valid else show the payment select field. – DAC84 Feb 28 '14 at 10:18
  • yes, i got the voucher validation done by Javascript. The validation function sets the voucher textfield to "Incorrect" or shows the valid code. I copied the voucher input field wrong it looks like `` and part of the Javascript conditional statement is `function psp_redirect() { if(( document.getElementById("gateway_code").value !="")){ ..redirect to gateway ...} else { send proces is done}`. But i noticed the form sent a free ticket when no value is in voucher input field. – alex Feb 28 '14 at 10:24

1 Answers1

1
<form action="" name="" method="">
  <select name="gateway_code" id="gateway_code">
  <option value="">---------</option>
  <option value="ideal">Cash</option>
  <option value="paypal">PayPal</option>
  <option value="creditcard">Credit Card (Visa, Mastercard)</option>
  </select>
  Vouchercode <input type="text" id="gateway_code" name="gateway_code" value""/>
</form>

Works for me. :]

Xatenev
  • 6,383
  • 3
  • 18
  • 42
  • Oops i got the input field wrong it looks like `Vouchercode ` and if the vouchercode is valid a ticket is sent else a payment method needs to be selected – alex Feb 28 '14 at 10:18