I have two columns in a table , first column has a select and the second has a list of checkboxes
I'm using smarty to get the number of rows of the table from php , then I use a loop in script code to generate onchange event for every select cell in the table ,
I'm lost with syntax ! what I want that when I change the select options the checkboxes in the second cloumn become readonly or not . depeanding on the select option which has been chosen .
when I open the source of the page I find that there's no code generated in the script at all , it's like the smarty code is ignored
need your help to fing the error .
the script :
<script type="text/javascript">
$(document).ready(function() {
<%section name='i' start=0 loop=$rows_number%>
$('col_order<%$smarty.section.i.index%>').change(function(){
if( $('col_order<%$smarty.section.i.index%>').val=='first')
{
$("col_list<%$smarty.section.i.index%>_0").attr('selected','y');
$("col_list<%$smarty.section.i.index%>_0").attr('disabled',false);
$("col_list<%$smarty.section.i.index%>_1").attr('selected','y');
$("col_list<%$smarty.section.i.index%>_1").attr('disabled',false);
}
else if( $('col_order<%$smarty.section.i.index%>').val=='second')
{
$("col_list<%$smarty.section.i.index%>_0").attr('selected','n');
$("col_list<%$smarty.section.i.index%>_0").attr('disabled',true);
$("col_list<%$smarty.section.i.index%>_1").attr('selected','n');
$("col_list<%$smarty.section.i.index%>_1").attr('disabled',true);
}
});
});
<%/section%>
</script>