Support

Account

Home Forums Add-ons Repeater Field Use select to display repeater field

Unread

Use select to display repeater field

  • Hi , i created repeater fields which i display in a select,
    i need your help to show or hide a div with my select : in this div there is a a href to dwnlaod my pdf (sub_field), see my code :

    <?php if( have_rows('fiche_detaillee') ): ?>
    	<form id="diametre"> 
            <select onchange="if(this.selectedIndex == 0)
    	{
            document.getElementById('<strong>SER-0,20L</strong>').style.display = 'none';
    	document.getElementById('<strong>SER-0,30L</strong>').style.display = 'none';
    	}
    	else if(this.selectedIndex == 1)
    	{document.getElementById('SER-0,20L').style.display = 'inline';
    	document.getElementById('SER-0,30L').style.display = 'none';
    	}
    	else
    	{document.getElementById('SER-0,20L').style.display = 'none';
    	document.getElementById('SER-0,30L').style.display = 'inline';
    	}">
    				
    	<option selected="selected">Choisissez le ø</option>
    			
    	<?php while( have_rows('fiche_detaillee') ): the_row(); 
    	// vars
    	$diam = get_sub_field('diam');
    	$pdf = get_sub_field('fichiers_selon_o_');
    	?>
    		
    	<option value="<?php echo $diam; ?>" ><?php echo $diam; ?></option>
    		<?php endwhile; ?>	
             </select></form>
    		<?php endif; ?>
    

    it work because i wrote the value ‘SER-0,20L’ etc… but i want it’s variable and automatically
    and i don’t know how make my script “variable”… you see ?
    if i use :

    document.getElementById(<?php echo $diam2; ?>).style.display = "block";
    

    it ruturn not all the values, or a multiple script…

    SEE the result i want here

    Please help !
    thanks !

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.