Welcome Guest, Not a member yet? Register   Sign In
another problem on select change
#1

[eluser]il_dandi[/eluser]
Hi! I've a field in my view


<select name="tipoInOut" id="tipoInOut">
<option value="I"&lt;? if($tipoInOut=='I') echo " selected" ?&gt;>Ingresso</option>
<option value="O"&lt;? if($tipoInOut=='O') echo " selected" ?&gt;>Uscita</option>
</select>


Now I've to add a condition for manage the selected value

&lt;? if($tipoInOut=='I') {?&gt;

<select name="idMittente" id="idMittente">
....

my problem is this: if user change the value I've to re-execute the if condition for verify the value to show in second select ... I've to manage this each time that user change the value of "tipoInOut" field

Can you help??
#2

[eluser]pickupman[/eluser]
Please when posting code, use the code button in the editor. It allows to read the code better, and copy and paste it as well. Otherwise your characters are converted to safe characters. Since in your other thread you are using jQuery, you want to use it for this as well.
Code:
$("#idMittente").hide(); //hide select
$("#tipoInOut").change(function(){

   var val = $(this).val(); //Get selected value
   if(val == 'I')
   {
     $("#idMittente").fadeIn(); //display select
   }
});




Theme © iAndrew 2016 - Forum software by © MyBB