Change email destination when clicking a select option on a form

1

Well, I have a form and I need it when selecting a select option to change:

1 line - action
2 line - value
3 line - value
15 line - Change where this is written sendOrca2 for eg enviaOrca1

<form id="formulario2" name="formulario2" method="post" enctype="multipart/form-data" action="mail-lista-de-descontos.php"  >
        <input type="hidden" name="acao" id="acao" value="enviaOrca2" />
        <input type="hidden" name="mailTo" id="mailTo" value="[email protected]" />
        <label>Email:</label>
        <input type="email" name="email" id="email" data-required="1" data-title="E-mail" required>
        <label>Dia:</label>
        <select name="lista">
            <option value="Sexta15abril">Sexta 15 de Abril</option>
            <option value="Sábado16abril">Sábado 16 de Abril</option>
            <option value="Sexta22abril">Sexta 22 de Abril</option>
            <option value="Sábado23abril">Sábado 23 de Abril</option>
        </select>
        <label>Nomes Completos:</label>
        <textarea name="mensagem" id="mensagem" data-required="1" data-title="Mensagem" placeholder="Exemplo: João da silva, Tenório Antonio" ></textarea>
        <a href="javascript:enviaOrca2()" title="Enviar">Enviar</a>
    </form>

The only solution I found was this below only I do not know how to change several options at a time

<select id='seuSelect' onChange='alteraAction(this.value)' >

// seus options aqui, lembre-se, cada option deve ter um 'value'

</select>

function alteraAction(valor) { 
if (valor == "Segunda Opção") {
    $('#idFormulario').attr('action', 'novaaction.php');
   }
}
    
asked by anonymous 04.05.2016 / 00:32

1 answer

0

Just add the change you want in function

function alteraAction(valor) { 
if (valor == "Segunda Opção") {
    $('#idFormulario').attr('action', 'novaaction.php');
    $('#email').val('[email protected]');
   }
}
    
04.05.2016 / 01:45